From d11addea4ac112bd7f1383657e3d578fc8b85a24 Mon Sep 17 00:00:00 2001 From: clement Date: Sun, 28 Jun 2026 21:45:26 +0200 Subject: [PATCH] fix: clear color instrument via string default --- sound_algo/data_only/matrix.scd | 2 +- sound_algo/data_only/test/test_matrix.scd | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/sound_algo/data_only/matrix.scd b/sound_algo/data_only/matrix.scd index 3db3ec4..3e840d1 100644 --- a/sound_algo/data_only/matrix.scd +++ b/sound_algo/data_only/matrix.scd @@ -389,7 +389,7 @@ File.exists(~matDir).not.if({ ("mkdir -p " ++ ~matDir.quote).systemCmd }); var ok = true; var v = value; (field.asSymbol == \inst).if({ - v = ((value == \default) or: { value.isNil }).if({ nil }, { value.asSymbol }); + v = ((value.asSymbol == \default) or: { value.isNil }).if({ nil }, { value.asSymbol }); ok = v.isNil or: { (~matInstChoices[name] ? []).includes(v) }; }); ((field.asSymbol == \cutoff) or: { field.asSymbol == \pan }).if({ diff --git a/sound_algo/data_only/test/test_matrix.scd b/sound_algo/data_only/test/test_matrix.scd index 0ade7ab..e31bbba 100644 --- a/sound_algo/data_only/test/test_matrix.scd +++ b/sound_algo/data_only/test/test_matrix.scd @@ -354,6 +354,15 @@ pass = pass and: { ~matLoad.("cleg") }; pass = pass and: { ~matColorDefs[4][3][\amp] == 1.0 }; // defaulted (color 3 amp default) File.delete(~matDir +/+ "cleg.matrix"); +// REGRESSION: clear a per-color instrument to default via the STRING "default" (web path) +~matColorDefs[6][2][\inst] = \do_strike; // arp, color 2 (do_strike is a valid arp choice) +~matSetColorDef.(6, 2, \inst, "default"); // String, as OSC delivers it +pass = pass and: { ~matColorDefs[6][2][\inst].isNil }; // cleared +// valid inst as a String also works +~matSetColorDef.(6, 2, \inst, "do_strike"); +pass = pass and: { ~matColorDefs[6][2][\inst] == \do_strike }; +~matColorDefs[6][2][\inst] = nil; // restore + pass.if( { "TEST PASS".postln }, { "TEST FAIL".postln }