zynaddsubfx

ZynAddSubFX open source synthesizer
Log | Files | Refs | Submodules | LICENSE

commit 1f7bb497cafeecebcadedb7723f8aab3e36a6b8d
parent 0190e89fed40f5ac3b2165440b2101eee5aa6a52
Author: Ricard Wanderlof <polluxsynth@butoba.net>
Date:   Thu, 24 Feb 2022 23:49:33 +0100

MiddleWare.cpp: Send OSC type tag ,N for empty bank search

With the following commit in Zest:
"osc-bridge: Only treat 2+ arg messages as vectors"
/bank/search_results messages with no arguments, as the result
of the search yielding no results, will be ignored by osc-bridge,
and consequently the patch list will not be updated when the
search results is an empty list, ultimately resulting in the patch
column erroneously displaying whatever was the result of the
previous search.

Fix this by emitting a ,N (Nil) OSC type tag indicating that
there is actually no argument data, when the search result
is empty. This message will be correctly interpreted by osc-bridge
in Zest, resulting in a zero length write to the cache, and
subsequent display of the search results in the form of an
empty preset column, as intended.

Diffstat:
Msrc/Misc/MiddleWare.cpp | 4+++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/Misc/MiddleWare.cpp b/src/Misc/MiddleWare.cpp @@ -1395,6 +1395,7 @@ const rtosc::Ports bankPorts = { #define MAX_SEARCH 300 char res_type[MAX_SEARCH+1] = {}; rtosc_arg_t res_dat[MAX_SEARCH] = {}; + res_type[0] = 'N'; // Will be overwritten if there is any actual data for(unsigned i=0; i<res.size() && i<MAX_SEARCH; ++i) { res_type[i] = 's'; res_dat[i].s = res[i].c_str(); @@ -1408,6 +1409,7 @@ const rtosc::Ports bankPorts = { #define MAX_SEARCH 300 char res_type[MAX_SEARCH+1] = {}; rtosc_arg_t res_dat[MAX_SEARCH] = {}; + res_type[0] = 'N'; // Will be overwritten if there is any actual data for(unsigned i=0; i<res.size() && i<MAX_SEARCH; ++i) { res_type[i] = 's'; res_dat[i].s = res[i].c_str(); @@ -1417,7 +1419,7 @@ const rtosc::Ports bankPorts = { rEnd}, {"search_results:", 0, 0, rBegin; - d.reply("/bank/search_results", ""); + d.reply("/bank/search_results", "N"); rEnd}, };