<plugin resizable="true">
	<ui:eval id="num_filters" value="(ex :gl_16) ? 32 : 16"/>
	<ui:eval id="num_blocks" value="(ex :gl_16) ? 8 : 4"/>

	<!-- Control linking -->
	<ui:for id="port" list="'xs'; 'xm'; 'xe'; 'g'">
		<ui:for id="i" first="0" count=":num_filters">
			<ctl:link
				id.1="${port}l_${i}" value.1=":${port}r_${i}"
				id.2="${port}r_${i}" value.2=":${port}l_${i}"
				activity=":clink" />
		</ui:for>
	</ui:for>

	<grid rows="3" cols="3" spacing="4">

		<!-- Graph -->
		<group ui:inject="GraphGroup" ipadding="0" expand="true" fill="true" text="labels.graphs.spectrum">
			<graph width.min="640" height.min="340" expand="true">
				<origin hpos="-1" vpos="-1" visible="false"/>

				<!-- Gray grid -->
				<ui:with ox="1" oy="0" color="graph_alt_2" visibility=":zoom le -39 db">
					<ui:for id="g" counter="i" list="+8;+7;+5;+4;+2;+1;-1;-2;-4;-5;-7;-8">
						<marker v="${g} db" />
					</ui:for>
				</ui:with>
				<ui:with color="graph_alt_1">
					<marker value="20000" color="graph_alt_1"/>
					<ui:with ox="1" oy="0">
						<ui:for id="g" first="-36" last="36" step="24">
							<marker v="${g} db"/>
						</ui:for>
						<ui:for id="g" first="-18" last="18" step="12">
							<marker v="${g} db" visibility=":zoom le -18 db"/>
						</ui:for>
						<ui:for id="g" first="-9" last="9" step="6">
							<marker v="${g} db" visibility=":zoom le -33 db"/>
						</ui:for>
					</ui:with>
					<ui:for id="f" first="20" last="90" step="10">
						<marker v="${:f}"/>
						<marker v="${:f*10}"/>
						<marker v="${:f*100}"/>
					</ui:for>
				</ui:with>

				<!-- Yellow grid -->
				<ui:with color="graph_sec">
					<marker v="100"/>
					<marker v="1000"/>
					<marker v="10000"/>
					<ui:with ox="1" oy="0">
						<marker v="+24 db"/>
						<marker v="0 db"/>
						<marker v="-24 db"/>
					</ui:with>
				</ui:with>

				<!-- Piano keys -->
				<embed oy="4" start.x="midi_freq_start(12, 127)" start.y="20" end.x="midi_freq_end(12, 127)" end.y="44" valign="1" alpha="0" visibility=":_ui_graph_piano_layout">
					<piano natural="false" note.min="12" note.max="127" height="24" editable="false" selectable="false" border="0"/>
				</embed>

				<!-- Octave text -->
				<ui:with ox="0" oy="4" y="44" halign="1" valign="1" pgroup="0" priority="10" visibility=":_ui_graph_piano_layout" pad.b="2">
					<ui:for id="octave" first="0" last="9">
						<text x="midi_freq(12 * ${:octave + 1})" text="lists.notes.fmt.c" text:octave="${octave}" valign="1" halign="0"/>
					</ui:for>
				</ui:with>

				<!-- Meshes -->

				<mesh id="ifg_l" oy=":_ui_zoomable_spectrum_graph ? 1 : 3" width="0" color="left_in" color.a="0.8" fcolor.a="0.8" fill="true" fcolor="left_in" visibility=":ife_l"/>
				<mesh id="ifg_r" oy=":_ui_zoomable_spectrum_graph ? 1 : 3" width="0" color="right_in" color.a="0.8" fcolor.a="0.8" fill="true" fcolor="right_in" visibility=":ife_r"/>
				<mesh id="rfg_l" oy=":_ui_zoomable_spectrum_graph ? 1 : 3" width="2" color="left_in" visibility=":rfe_l"/>
				<mesh id="rfg_r" oy=":_ui_zoomable_spectrum_graph ? 1 : 3" width="2" color="right_in" visibility=":rfe_r"/>
				<mesh id="ofg_l" oy=":_ui_zoomable_spectrum_graph ? 1 : 3" width="2" color="left" visibility=":ofe_l"/>
				<mesh id="ofg_r" oy=":_ui_zoomable_spectrum_graph ? 1 : 3" width="2" color="right" visibility=":ofe_r"/>

				<mesh id="ag_l" width="3" color="left" fill="true" fcolor="left" fcolor.a="0.8" smooth="true" visibility=":fltv_l"/>
				<mesh id="ag_r" width="3" color="right" fill="true" fcolor="right" fcolor.a="0.8" smooth="true" visibility=":fltv_r"/>
				<ui:if test=":num_filters ile 16">
					<ui:for id="y" counter="i" list="14.62;23.27;36.74;58.48;92.83;146.20;232.70;367.45;584.80;928.32;1462.01;2326.97;3674.49;5848.04;9283.18;14620.09">
						<marker ui:id="filter_markerl_${i}" v="${y}" ox="0" oy="1" color="left" visibility="false"/>
						<dot
							ui:id="filter_dotl_${i}"
							x="${y}" y.id="gl_${i}"
							y.editable="true"
							pointer="hand"
							size="1 + 2*:_ui_filter_point_thickness"
							hover.size="1 + 2*:_ui_filter_point_thickness"
							bsize="4"
							color="left"
							hover.color="left"
							bcolor="left"
							hover.bcolor="left"
							visibility=":fvl_${i}"
							y.astep="1" />
					</ui:for>
					<ui:for id="y" counter="i" list="17.10;27.07;42.86;68.40;107.72;171.00;270.74;428.63;683.99;1077.22;1709.98;2707.39;4286.31;6839.91;10772.17;17099.76">
						<marker ui:id="filter_markerr_${i}" v="${y}" ox="0" oy="1" color="right" visibility="false"/>
						<dot
							ui:id="filter_dotr_${i}"
							x="${y}" y.id="gr_${i}"
							y.editable="true"
							pointer="hand"
							size="1 + 2*:_ui_filter_point_thickness"
							hover.size="1 + 2*:_ui_filter_point_thickness"
							bsize="4"
							color="right"
							hover.color="right"
							bcolor="right"
							hover.bcolor="right"
							visibility=":fvr_${i}"
							y.astep="1" />
					</ui:for>
				</ui:if>

				<ui:if test=":num_filters igt 16">
					<ui:for
						id="y"
						counter="i"
						list="14.91;18.91;23.71;29.82;37.46;47.43;59.64;74.92;94.57;119.27;149.09;189.15;237.14;298.18;374.59;474.29;596.37;749.18;945.74;1192.74;1490.92;1891.48;2371.43;2981.84;3745.92;4742.86;5963.69;7491.83;9457.42;11927.37;14909.23;18914.82">
						<marker ui:id="filter_markerl_${i}" v="${y}" ox="0" oy="1" color="left" visibility="false"/>
						<dot
							ui:id="filter_dotl_${i}"
							x="${y}" y.id="gl_${i}"
							y.editable="true"
							pointer="hand"
							size="1 + 2*:_ui_filter_point_thickness"
							hover.size="1 + 2*:_ui_filter_point_thickness"
							bsize="4"
							color="left"
							hover.color="left"
							bcolor="left"
							hover.bcolor="left"
							visibility=":fvl_${i}"
							y.astep="1" />
					</ui:for>
					<ui:for
						id="y"
						counter="i"
						list="16.77;21.15;26.57;33.54;42.05;53.13;67.07;84.09;105.74;134.15;167.68;211.47;265.66;335.36;420.46;531.33;670.73;840.92;1057.37;1341.45;1676.81;2114.74;2656.63;3353.63;4204.58;5313.25;6707.26;8409.16;10573.72;13414.51;16768.14;21147.40">
						<marker ui:id="filter_markerr_${i}" v="${y}" ox="0" oy="1" color="right" visibility="false"/>
						<dot
							ui:id="filter_dotr_${i}"
							x="${y}" y.id="gr_${i}"
							y.editable="true"
							pointer="hand"
							size="1 + 2*:_ui_filter_point_thickness"
							hover.size="1 + 2*:_ui_filter_point_thickness"
							bsize="4"
							color="right"
							hover.color="right"
							bcolor="right"
							hover.bcolor="right"
							visibility=":fvr_${i}"
							y.astep="1" />
					</ui:for>
				</ui:if>

				<!-- Boundaries -->
				<marker ox="2" oy="0" v="1" color="graph_prim" visibility="false"/>
				<!-- +48 dB -->
				<marker ox="0" oy="1" v="24000" color="graph_prim" visibility="false"/>

				<!-- Axis -->
				<axis min="10" max="24000" angle="0.0" log="true" visibility="false"/>
				<axis min="-48 db / :zoom" max="48 db * :zoom" angle="0.5" log="true" visibility="false"/>
				<!-- -48..+48 dB -->
				<axis min="-1" max="1" visible="false" angle="0.5"/>
				<axis min="-48 db" max="48 db" angle="0.5" log="true" visibility="false"/>
				<axis min="0" max=":_a_scaled_height" visibility="false" angle="0.5"/>

				<!-- Text -->
				<ui:with ox="0" oy="2" y="0" halign="1" valign="1" pgroup="0" priority="0">
					<text x="10" text="graph.units.hz"/>
					<text x="20" text="20"/>
					<text x="30" text="30"/>
					<text x="50" text="50"/>
					<text x="100" text="100"/>
					<text x="200" text="200"/>
					<text x="300" text="300"/>
					<text x="500" text="500"/>
					<text x="1000" text="graph.values.x_k" text:value="1"/>
					<text x="2000" text="graph.values.x_k" text:value="2"/>
					<text x="3000" text="graph.values.x_k" text:value="3"/>
					<text x="5000" text="graph.values.x_k" text:value="5"/>
					<text x="10000" text="graph.values.x_k" text:value="10"/>
					<text x="20000" text="graph.values.x_k" text:value="20"/>
				</ui:with>

				<ui:with x="10" halign="1" pgroup="0" priority="10">
					<text y="0 db" text="0" valign="1" priority="0" />
					<text y="1" ox="0" oy="2" text="graph.units.db" valign="-1" priority="0" />

					<ui:for id="g" counter="i" list="+36;+24;+12;-12;-24;-36">
						<text y="${g} db" text="${g}" valign="-1" />
					</ui:for>
					<ui:for id="g" counter="i" list="+18;+6;-6;-18">
						<text y="${g} db" text="${g}" valign="-1" visibility=":zoom le -18 db"/>
					</ui:for>
					<ui:for id="g" counter="i" list="+9;+3;-3;-9">
						<text y="${g} db" text="${g}" valign="-1" visibility=":zoom le -33 db"/>
					</ui:for>
					<ui:for id="g" counter="i" list="+8;+7;+5;+4;+2;+1;-1;-2;-4;-5;-7;-8">
						<text y="${g} db" text="${g}" valign="-1" visibility="(:zoom le -39 db) "/>
					</ui:for>
				</ui:with>

				<ui:if test=":num_filters ile 16">
					<ui:for id="y" counter="i"
						list="14.62;23.27;36.74;58.48;92.83;146.20;232.70;367.45;584.80;928.32;1462.01;2326.97;3674.49;5848.04;9283.18;14620.09">
						<text
							ui:id="filter_infol_${i}"
							oy="2"
							x="${y}" y="1"
							color="left"
							visibility="false"
							halign="${(:y lt 500) ? 1 : -1}"
							valign="-1"
							text.halign="${(:y lt 500) ? -1 : 1}"
							pad.h="4"
						/>
					</ui:for>
					<ui:for id="y" counter="i"
						list="17.10;27.07;42.86;68.40;107.72;171.00;270.74;428.63;683.99;1077.22;1709.98;2707.39;4286.31;6839.91;10772.17;17099.76">
						<text
							ui:id="filter_infor_${i}"
							oy="2"
							x="${y}" y="1"
							color="right"
							visibility="false"
							halign="${(:y lt 500) ? 1 : -1}"
							valign="-1"
							text.halign="${(:y lt 500) ? -1 : 1}"
							pad.h="4"
						/>
					</ui:for>
				</ui:if>

				<ui:if test=":num_filters igt 16">
					<ui:for id="y" counter="i" list="14.91;18.91;23.71;29.82;37.46;47.43;59.64;74.92;94.57;119.27;149.09;189.15;237.14;298.18;374.59;474.29;596.37;749.18;945.74;1192.74;1490.92;1891.48;2371.43;2981.84;3745.92;4742.86;5963.69;7491.83;9457.42;11927.37;14909.23;18914.82">
						<text
							ui:id="filter_infol_${i}"
							oy="2"
							x="${y}" y="1"
							color="left"
							visibility="false"
							halign="${(:y lt 500) ? 1 : -1}"
							valign="-1"
							text.halign="${(:y lt 500) ? -1 : 1}"
							pad.h="4"
						/>
					</ui:for>
					<ui:for id="y" counter="i"
						list="16.77;21.15;26.57;33.54;42.05;53.13;67.07;84.09;105.74;134.15;167.68;211.47;265.66;335.36;420.46;531.33;670.73;840.92;1057.37;1341.45;1676.81;2114.74;2656.63;3353.63;4204.58;5313.25;6707.26;8409.16;10573.72;13414.51;16768.14;21147.40">
						<text
							ui:id="filter_infor_${i}"
							oy="2"
							x="${y}" y="1"
							color="right"
							visibility="false"
							halign="${(:y lt 500) ? 1 : -1}"
							valign="-1"
							text.halign="${(:y lt 500) ? -1 : 1}"
							pad.h="4"
						/>
					</ui:for>
				</ui:if>

			</graph>
		</group>

		<!-- Zoom Fader -->
		<hbox spacing="4" bg.color="bg">
			<vbox vexpand="true" bg.color="bg_schema">
				<label font.name="lsp-icons" font.size="12" font.antialias="true" text="icons.main.zoom" color="text_icon" pad.b="4" pad.t="4"/>
				<fader id="zoom" angle="1" vexpand="true" bg.inherit="true" flat="true"/>
				<value id="zoom" width="40"/>
			</vbox>

			<!-- Signal meters -->

			<vbox vexpand="true" bg.color="bg_schema">
				<label text="labels.chan.in" pad.b="3" pad.t="3"/>
				<ledmeter vexpand="true" angle="1">
					<ledchannel id="iml" min="-36 db" max="+6 db" log="true" type="rms_peak" peak.visibility="true" value.color="left_in"/>
					<ledchannel id="imr" min="-36 db" max="+6 db" log="true" type="rms_peak" peak.visibility="true" value.color="right_in"/>
				</ledmeter>
			</vbox>

			<vbox vexpand="true" bg.color="bg_schema">
				<label text="labels.chan.out" pad.b="3" pad.t="3"/>
				<ledmeter vexpand="true" angle="1">
					<ledchannel id="sml" min="-36 db" max="+6 db" log="true" type="rms_peak" peak.visibility="true" value.color="left"/>
					<ledchannel id="smr" min="-36 db" max="+6 db" log="true" type="rms_peak" peak.visibility="true" value.color="right"/>
				</ledmeter>
			</vbox>
		</hbox>

		<vbox spacing="4">
			<group text="groups.signal" expand="true">
				<grid rows="3" cols="2" hspacing="4">
					<knob id="g_in" pad.r="4"/>
					<vbox vfill="false">
						<label text="labels.input" halign="0"/>
						<value id="g_in" sline="true" halign="0"/>
					</vbox>

					<knob id="g_out" pad.r="4"/>
					<vbox vfill="false">
						<label text="labels.output" expand="true" halign="0"/>
						<value id="g_out" width.min="50" sline="true" halign="0"/>
					</vbox>

					<knob id="bal" balance="0.5" scolor="balance" pad.r="4"/>
					<vbox vfill="false">
						<label text="labels.balance" halign="0"/>
						<value id="bal" width.min="50" sline="true" halign="0"/>
					</vbox>

				</grid>
			</group>
			<!-- Analysis -->
			<group text="groups.analysis" expand="true" ipadding="0">
				<vbox>
					<grid rows="6" cols="2">
						<align halign="-1" pad.t="4" pad.l="6">
							<label text="labels.fft.fft_in"/>
						</align>
						<hbox spacing="4" pad.v="4" pad.h="6" hfill="false">
							<button id="ife_l" text="labels.chan.L_eft" size="19" ui:inject="Button_left_8"/>
							<button id="ife_r" text="labels.chan.R_ight" size="19" ui:inject="Button_right_8"/>
						</hbox>
						<cell cols="2"><hsep pad.v="2" bg.color="bg" vreduce="true"/></cell>

						<align halign="-1" pad.t="4" pad.l="6">
							<label text="labels.fft.fft_out" halign="0"/>
						</align>
						<hbox spacing="4" pad.v="4" pad.h="6" hfill="false">
							<button id="ofe_l" text="labels.chan.L_eft" size="19" ui:inject="Button_left_8"/>
							<button id="ofe_r" text="labels.chan.R_ight" size="19" ui:inject="Button_right_8"/>
						</hbox>
						<cell cols="2"><hsep pad.v="2" bg.color="bg" vreduce="true"/></cell>

						<align halign="-1" pad.t="4" pad.l="6">
							<label text="labels.fft.fft_link" halign="0"/>
						</align>
						<hbox spacing="4" pad.v="4" pad.h="6" hfill="false">
							<button id="rfe_l" text="labels.chan.L_eft" size="19" ui:inject="Button_left_8"/>
							<button id="rfe_r" text="labels.chan.R_ight" size="19" ui:inject="Button_right_8"/>
						</hbox>
						<cell cols="2"><hsep pad.v="2" bg.color="bg" vreduce="true"/></cell>
					</grid>

					<grid rows="2" cols="2" transpose="false" expand="true" hspacing="4">
						<knob id="react" size="20" pad.r="4" pad.l="6"/>
						<vbox vfill="false" pad.r="6">
							<label text="labels.metering.reactivity" halign="0"/>
							<value id="react" width.min="50" sline="true" halign="0"/>
						</vbox>

						<knob id="shift" size="20" pad.r="4" pad.l="6"/>
						<vbox vfill="false" pad.r="6">
							<label text="labels.metering.shift" halign="0"/>
							<value id="shift" width.min="50" sline="true" halign="0"/>
						</vbox>
					</grid>
				</vbox>
			</group>
		</vbox>

		<!-- bottom line -->
		<cell cols="3">
			<hbox spacing="4" bg.color="bg_schema" pad.h="6">
				<label text="labels.mode" pad.v="4"/>
				<combo id="slope" pad.r="6" pad.v="4"/>
				<combo id="mode" pad.r="12" pad.v="4"/>
				<button id="clink" ui:inject="Button_green" text="labels.chan.lr_link" />
				<button id="fltv_l" height="22" width="48" text="labels.chan.left" ui:inject="Button_left" pad.v="4"/>
				<button id="fltv_r" height="22" width="48" text="labels.chan.right" ui:inject="Button_right" pad.v="4"/>

				<void hexpand="true"/>

				<vsep bg.color="bg" pad.h="2" hreduce="true" hexpand="false"/>

				<shmlink id="return" pad.v="4" pad.l="2"/>
				<shmlink id="send" pad.v="4"/>
			</hbox>
		</cell>

		<cell cols="3">
			<cgroup id="fsel" bg.color="bg" ipadding="0" text="lists.graph_eq.bands">
				<ui:for id="blk" first="0" last=":num_blocks - 1">
					<ui:eval id="chc" value="(:blk mod 2) ? 'right' : 'left'"/>
					<ui:eval id="chp" value="(:blk mod 2) ? 'r' : 'l'"/>
					<ui:eval id="f" value=":blk idiv 2"/>

					<grid ui:group="filters" rows="5" cols="33" hspacing="2">
						<ui:with bg.color="bg_schema">
							<label text="labels.units.hz" fill="true" halign="0" pad="6"/>
							<!-- x16 frequencies -->
							<ui:if test=":num_filters ile 16">
								<ui:for id="f" counter="k" list="16;25;40;63;100;160;250;400;630">
									<cell rows="5" bg.color="bg" pad.v="6"><vsep pad="0"/></cell>
									<label ui:group="grp_filter${chp}_${k}" text="${f}"/>
								</ui:for>
								<ui:for id="f" counter="k" list="1;'1.6';'2.5';4;'6.3';10;16">
									<cell rows="5" bg.color="bg" pad.v="6"><vsep pad="0"/></cell>
									<label ui:group="grp_filter${chp}_${:k+9}" text="labels.values.x_k" text:value="${f}"/>
								</ui:for>
							</ui:if>
							<!-- x32 frequencies (part 1) -->
							<ui:if test="(:num_filters igt 16) and (:f ieq 0)">
								<ui:for id="f" counter="k" list="16;20;25;'31.5';40;50;63;80;100;125;160;200;250;315;400;500">
									<cell rows="5" bg.color="bg" pad.v="6"><vsep pad="0"/></cell>
									<label ui:group="grp_filter${chp}_${k}" text="${f}"/>
								</ui:for>
							</ui:if>
							<!-- x32 frequencies (part 2) -->
							<ui:if test="(:num_filters igt 16) and (:f ieq 1)">
								<ui:for id="f" counter="k" list="630;800">
									<cell rows="5" bg.color="bg" pad.v="6"><vsep pad="0"/></cell>
									<label ui:group="grp_filter${chp}_${:k+16}" text="${f}"/>
								</ui:for>
								<ui:for id="f" counter="k" list="1;'1.25';'1.6';2;'2.5';'3.15';4;5;'6.3';8;10;'12.5';16;20">
									<cell rows="5" bg.color="bg" pad.v="6"><vsep pad="0"/></cell>
									<label ui:group="grp_filter${chp}_${:k+18}" text="labels.values.x_k" text:value="${f}"/>
								</ui:for>
							</ui:if>

							<label text="labels.ctl" fill="true" halign="0" pad="6"/>
							<ui:for id="i" first=":f*16" last=":f*16+15">
								<ui:set id="ch" value="${chp}_${i}"/>
								<ui:with ui:group="grp_filter${ch}">
									<grid rows="2" cols="1" fill="false">
										<button ui:inject="Button_yellow_8" text="labels.chan.on" id="xe${ch}" width="42" height="10" pad="6"/>
										<hbox fill="false" spacing="4" pad.b="14" width="37">
											<button ui:inject="Button_green_8" id="xs${ch}" text="labels.chan.S_olo" height="10" width="19"/>
											<button ui:inject="Button_red_8" id="xm${ch}" text="labels.chan.M_ute" height="10" width="19"/>
										</hbox>
									</grid>
								</ui:with>
							</ui:for>

							<cell rows="2"><label text="labels.gain:db" fill="true" halign="0" pad="6"/></cell>
							<ui:for id="i" first=":f*16" last=":f*16+15">
								<knob ui:group="grp_filter${chp}_${i}" ui:id="filter_gain${chp}_${i}" id="g${chp}_${i}" size="20" scolor="${chc}"/>
							</ui:for>

							<ui:for id="i" first=":f*16" last=":f*16+15">
								<value ui:group="grp_filter${chp}_${i}" id="g${chp}_${i}" detailed="false" pad.b="6"/>
							</ui:for>
						</ui:with>
					</grid>
				</ui:for>
			</cgroup>
		</cell>
	</grid>
</plugin>
