function HelperUDPPluginVisualizer
%HelperUDPPluginVisualizer Visualize plug-in as it runs in DAW
%   HelperUDPPluginVisualizer launches a magnitude response visualizer for
%   an equalizer being executed in a DAW.
%
%   This file  is used only in support of UDPDeployedAudioPluginExample and
%   may be modified or removed in the future.

% Copyright 2015-2018 The MathWorks, Inc.

%% Setup
UDPReceive = dsp.UDPReceiver('LocalIPPort', 20000, ...
    'MessageDataType', 'double', ...
    'MaximumMessageLength', 15, ...
    'ReceiveBufferSize', 15*80);
c = onCleanup(@()release(UDPReceive));
udpRec = UDPReceive(); %#ok

v = dsp.DynamicFilterVisualizer(8192, 44100, [20 20e3], 'XScale','Log');
show(v);

%% Streaming
tic
while toc < 60 % Visualize for 60 seconds        
    udpRec = UDPReceive();
    if ~isempty(udpRec)
        B = reshape(udpRec(1:9),3,3).';
        A = [ones(1,3);reshape(udpRec(10:15),2,3)].';
        v(B,A);
    end
end

