Skip to content

Commit 75c3ddb

Browse files
committed
Merge branch 'ui-test' into develop
2 parents f209b78 + ac7ed1d commit 75c3ddb

44 files changed

Lines changed: 3603 additions & 2762 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,7 @@ set(JUCE_COMPILE_DEFINITIONS
303303
JUCE_USE_COREIMAGE_LOADER=0
304304
JUCE_SILENCE_XCODE_15_LINKER_WARNING=1
305305
JUCE_USE_XRENDER=1
306+
JUCE_USE_MP3AUDIOFORMAT=1
306307
JUCE_COREGRAPHICS_RENDER_WITH_MULTIPLE_PAINT_CALLS=0
307308
JUCE_USE_DIRECTWRITE=0
308309
JUCE_JACK=1

Libraries/nanovg

Libraries/pd-else

Submodule pd-else updated 522 files

Resources/Fonts/IconFont.ttf

736 Bytes
Binary file not shown.

Resources/Patches/lua.pd_lua

Lines changed: 0 additions & 154 deletions
This file was deleted.

Resources/Patches/lua.pd_luajit

Lines changed: 164 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,164 @@
1+
local luaobj = pd.Class:new():register("lua")
2+
3+
local bit = require("bit")
4+
5+
local TWO31 = 2147483648
6+
local function rand_u31()
7+
return bit.band(
8+
bit.tobit(math.random() * 4294967296), -- 2^32
9+
0x7fffffff
10+
)
11+
end
12+
13+
function luaobj:initialize(sel, atoms)
14+
self.inlets = {}
15+
self.outlets = {}
16+
self.gui = 0
17+
18+
local code_start = 0
19+
20+
local i = 1
21+
while i <= #atoms do
22+
local atom = atoms[i]
23+
if i > 1 and atom == ";" then
24+
code_start = i;
25+
break -- Stop if we reach the first occurrence of ";"
26+
end
27+
28+
if type(atom) == "string" then
29+
if atom == "-in" and i < #atoms and type(atoms[i + 1]) == "number" then
30+
local in_count = atoms[i + 1]
31+
for _ = 1, in_count do
32+
table.insert(self.inlets, DATA)
33+
end
34+
i = i + 1 -- Skip the next element since we've used it
35+
elseif atom == "-sigin" and i < #atoms and type(atoms[i + 1]) == "number" then
36+
local sigin_count = atoms[i + 1]
37+
for _ = 1, sigin_count do
38+
table.insert(self.inlets, SIGNAL, 1)
39+
end
40+
i = i + 1 -- Skip the next element since we've used it
41+
elseif atom == "-out" and i < #atoms and type(atoms[i + 1]) == "number" then
42+
local out_count = atoms[i + 1]
43+
for _ = 1, out_count do
44+
table.insert(self.outlets, DATA)
45+
end
46+
i = i + 1 -- Skip the next element since we've used it
47+
elseif atom == "-sigout" and i < #atoms and type(atoms[i + 1]) == "number" then
48+
local sigout_count = atoms[i + 1]
49+
for _ = 1, sigout_count do
50+
table.insert(self.outlets, SIGNAL, 1)
51+
end
52+
i = i + 1 -- Skip the next element since we've used it
53+
end
54+
end
55+
i = i + 1
56+
end
57+
58+
for _ = 1, code_start do
59+
table.remove(atoms, 1)
60+
end
61+
62+
-- Concatenate atoms into a single string separated by spaces
63+
local lua_code = table.concat(atoms, " ")
64+
lua_code = string.gsub(lua_code, ";", "\n")
65+
66+
self.function_prefix = "fn_" .. tostring(rand_u31()) .. "_"
67+
68+
-- Give functions unique names to prevent namespace clashes
69+
lua_code = string.gsub(lua_code, "function%s+in_(%d+)_(%a+)", function(num, type)
70+
return "function " .. self.function_prefix .. "in_" .. num .. "_" .. type
71+
end)
72+
lua_code = string.gsub(lua_code, "function%s+in_n_(%a+)", function(type)
73+
return "function " .. self.function_prefix .. "in_n_" .. type
74+
end)
75+
lua_code = string.gsub(lua_code, "function%s+in_(%d+)", function(num)
76+
return "function " .. self.function_prefix .. "in_" .. num
77+
end)
78+
lua_code = string.gsub(lua_code, "function%s+in_n", function()
79+
return "function " .. self.function_prefix .. "in_n"
80+
end)
81+
lua_code = string.gsub(lua_code, "function%s$0", function()
82+
return "function " .. self.function_prefix
83+
end)
84+
lua_code = string.gsub(lua_code, "function%sdsp", function()
85+
return "function " .. self.function_prefix .. "dsp"
86+
end)
87+
lua_code = string.gsub(lua_code, "function%sperform", function()
88+
return "function " .. self.function_prefix .. "perform"
89+
end)
90+
91+
-- Create a temporary file
92+
self.temp_name = os.tmpname()
93+
local temp_file = io.open(self.temp_name, 'w+b')
94+
95+
if temp_file then
96+
-- Writing the concatenated string to the temp file
97+
temp_file:write(lua_code)
98+
99+
-- It's important to close the file when you're done
100+
temp_file:close()
101+
102+
self:dofile(self.temp_name)
103+
else
104+
pd.post("Error: could not create temp file")
105+
end
106+
107+
return true
108+
end
109+
110+
function luaobj:dsp(sample_rate, block_size)
111+
local m = _G[self.function_prefix .. "dsp"]
112+
if type(m) == "function" then
113+
return m(self, sample_rate, block_size)
114+
end
115+
end
116+
117+
function luaobj:perform(...)
118+
local m = _G[self.function_prefix .. "perform"]
119+
if type(m) == "function" then
120+
return m(self, ...)
121+
end
122+
end
123+
124+
function luaobj:dispatch(inlet, sel, atoms)
125+
if sel == "load" then
126+
self:dofile(atoms[1])
127+
return
128+
end
129+
130+
local m = _G[self.function_prefix .. string.format("in_%d_%s", inlet, sel)]
131+
if type(m) == "function" then
132+
if sel == "bang" then return m(self) end
133+
if sel == "float" then return m(self, atoms[1]) end
134+
if sel == "symbol" then return m(self, atoms[1]) end
135+
if sel == "pointer" then return m(self, atoms[1]) end
136+
if sel == "list" then return m(self, atoms) end
137+
return m(self, atoms)
138+
end
139+
m = self[self.function_prefix .. "in_n_" .. sel]
140+
if type(m) == "function" then
141+
if sel == "bang" then return m(self, inlet) end
142+
if sel == "float" then return m(self, inlet, atoms[1]) end
143+
if sel == "symbol" then return m(self, inlet, atoms[1]) end
144+
if sel == "pointer" then return m(self, inlet, atoms[1]) end
145+
if sel == "list" then return m(self, inlet, atoms) end
146+
return m(self, inlet, atoms)
147+
end
148+
m = self[self.function_prefix .. string.format("in_%d", inlet)]
149+
if type(m) == "function" then
150+
return m(self, sel, atoms)
151+
end
152+
m = self[self.function_prefix .. "in_n"]
153+
if type(m) == "function" then
154+
return m(self, inlet, sel, atoms)
155+
end
156+
self:error(
157+
string.format("no method for `%s' at inlet %d of Lua object `%s'",
158+
sel, inlet, self._name)
159+
)
160+
end
161+
162+
function luaobj:__gc()
163+
os.remove(self.temp_name)
164+
end

Resources/Scripts/package_resources.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -124,10 +124,10 @@ def replaceTextInFolder(folder_path, old_string, new_string):
124124
globCopy(project_root + "/Libraries/pd-else/Abstractions/Control/*.pd", "./Abstractions/else")
125125
globCopy(project_root + "/Libraries/pd-else/Abstractions/Audio/*.pd", "./Abstractions/else")
126126
globCopy(project_root + "/Libraries/pd-else/Abstractions/Extra/*.pd", "./Abstractions/else")
127-
globCopy(project_root + "/Libraries/pd-else/Source/Control/*.pd_lua", "./Abstractions/else")
128-
globCopy(project_root + "/Libraries/pd-else/Source/Audio/*.pd_lua", "./Abstractions/else")
129-
globCopy(project_root + "/Libraries/pd-else/Abstractions/Extra/*.pd_lua", "./Abstractions/else")
130-
copyFile(project_root + "/Resources/Patches/lua.pd_lua", "./Abstractions/else")
127+
globCopy(project_root + "/Libraries/pd-else/Abstractions/Control/*.pd_luajit", "./Abstractions/else")
128+
globCopy(project_root + "/Libraries/pd-else/Abstractions/Audio/*.pd_luajit", "./Abstractions/else")
129+
globCopy(project_root + "/Libraries/pd-else/Abstractions/Extra/*.lua", "./Abstractions/else")
130+
copyFile(project_root + "/Resources/Patches/lua.pd_luajit", "./Abstractions/else")
131131
copyFile(project_root + "/Resources/Patches/playhead.pd", "./Abstractions")
132132
copyFile(project_root + "/Resources/Patches/param.pd", "./Abstractions")
133133
copyFile(project_root + "/Resources/Patches/daw_storage.pd", "./Abstractions")

Source/Canvas.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -472,7 +472,7 @@ void Canvas::updateFramebuffers(NVGcontext* nvg)
472472
if (dotsLargeImage.needsUpdate(gridBufferSize, gridBufferSize) || lastObjectGridSize != gridLogicalSize) {
473473
lastObjectGridSize = gridLogicalSize;
474474

475-
dotsLargeImage = NVGImage(nvg, gridBufferSize, gridBufferSize, [this, zoom, viewScale, gridLogicalSize, gridSizeCommon](Graphics& g) {
475+
dotsLargeImage = NVGImage(nvg, gridBufferSize, gridBufferSize, [zoom, viewScale, gridLogicalSize, gridSizeCommon](Graphics& g) {
476476
g.addTransform(AffineTransform::scale(viewScale, viewScale));
477477
float const ellipseRadius = zoom < 1.0f ? jmap(zoom, 0.25f, 1.0f, 3.0f, 1.0f) : 1.0f;
478478

0 commit comments

Comments
 (0)