Hi,
I’m writing a sc program that I need to share with other people. I made a GUI for a bunch of synths using Ndefs. I can’t use the default Ndef.gui because of styling issues which were solved by a custom GUI.
I developed the thing on SC 3.13.1 in NixOS. When trying to run it in SC 3.14.1 on MacOS it breaks. I discovered it’s because VLayout() changed with the version, and doesn’t implement .asView in 3.14.1.
I have 3 windows. This is the function building the GUI for the Ndef parameters:
var make_ndef_gui = { |ndef|
var layout = VLayout();
var width = 160;
var height = 30;
var fm_input;
layout.add(StaticText().string_(ndef.key.asString).font_(Font.default.boldVariant));
SynthDescLib.global.at(ndef.source).controls.do { |ctl, i|
if (ctl.rate != \audio and: { ctl.name != \out }) {
var kn = EZNumber(layout,
bounds: Rect(10,10,width,height),
label: ctl.name,
controlSpec: Spec.specs[ctl.name] ?? ControlSpec(0,1),
action: { |kn| ndef.set(ctl.name, kn.value.debug("%:%".format(ndef.key, ctl.name))) },
initVal: ctl.defaultValue,
labelWidth: width - 30,
layout: \horz,
);
// layout.add(HLayout(kn.labelView, kn.numberView, kn.knobView)); // EZKnob
layout.add(HLayout(kn.labelView, kn.numberView));
};
};
fm_input = EZNumber(layout,
bounds: Rect(10,10,width,height),
label: "fm_in",
controlSpec: ControlSpec(0, num_voices-1, \lin, step: 1, units: ""),
action: { |num| ndef.map(\in, Ndef((\voice_++num.value.asInteger).asSymbol.debug)) },
labelWidth: width - 30,
layout: \horz,
);
layout.add(HLayout(fm_input.labelView, fm_input.numberView));
w.layout.add(layout);
};
On 3.13.1 (NixOS) works fine.
On 3.14 (MacOS) throws: ^^ERROR: Message 'asView' not understood.
I checked and it certainly doesn’t exist in 3.14.1.
VLayout.findRespondingMethodFor(\asView);
// 3.13.1 (NixOS) -> Layout:asView
// 3.14.1 (MacOS) -> nil
Is there a way to make this work on both versions?
In case it’s not possible or overly complicated, how would the code in the function translate to v3.14.1? Does VLayout() accept EZGui objects without needing to get the inner views in 3.14.1?
UPDATE:
I upgraded to 3.14.1 on NixOS. Strangely enough, the code works, with some quirks, but it does show the windows and GUI elements. Any ideas why it doesn’t work on MacOS?