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

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

		<!-- Graph and Zoom Fader -->
		<cell rows="2">
			<hbox spacing="4" bg.color="bg" expand="true">
				<group ui:inject="GraphGroup" ipadding="0" expand="true" fill="true" text="labels.graphs.spectrum">
					<graph ui:id="para_eq_graph" width.min="640" height.min="380" 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:for id="g" first="-36" last="36" step="24">
							<marker v="${g} db" ox="1" oy="0" color="graph_alt_1"/>
						</ui:for>
						<ui:for id="g" first="-18" last="18" step="12">
							<marker v="${g} db" ox="1" oy="0" color="graph_alt_1" visibility=":zoom le -18 db"/>
						</ui:for>
						<ui:for id="g" first="-9" last="9" step="6">
							<marker v="${g} db" ox="1" oy="0" color="graph_alt_1" visibility=":zoom le -33 db"/>
						</ui:for>
						<ui:with ox="0" oy="1">
							<ui:for id="f" first="20" last="90" step="10">
								<marker v="${f}" color="graph_alt_1"/>
							</ui:for>
							<ui:for id="f" first="200" last="900" step="100">
								<marker v="${f}" color="graph_alt_1"/>
							</ui:for>
							<ui:for id="f" first="2000" last="9000" step="1000">
								<marker v="${f}" color="graph_alt_1"/>
							</ui:for>
							<marker value="20000" color="graph_alt_1"/>
						</ui:with>

						<!-- Yellow grid -->
						<ui:with ox="0" oy="1" color="graph_sec">
							<marker v="100"/>
							<marker v="1000"/>
							<marker v="10000"/>
						</ui:with>
						<ui:with ox="1" oy="0" color="graph_sec">
							<marker v="+24 db"/>
							<marker v="0 db"/>
							<marker v="-24 db"/>
						</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 -->
						<ui:for id="i" first="0" last=":num_filters - 1">
							<marker id="f_${i}" ox="0" oy="1" color="graph_marker_cycle" color.hue=":hue_${i}" color.a="0.5" visibility=":fv_${i}"/>
							<marker id="g_${i}" ox="1" oy="0" color="graph_marker_cycle" color.hue=":hue_${i}" color.a="0.5" visibility=":fv_${i}"/>
						</ui:for>
						<ui:for id="i" first="0" last=":num_filters - 1">
							<mesh id="agf_${i}" width="2" color="graph_mesh_cycle" color.hue=":hue_${i}" fill="true" fcolor="graph_mesh_cycle" fcolor.hue=":hue_${i}" color.a="0.3" fcolor.a="0.9" visibility=":fv_${i}" smooth="true"/>
						</ui:for>

						<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.a="0.5" color="left_in" visibility=":rfe_l"/>
						<mesh id="rfg_r" oy=":_ui_zoomable_spectrum_graph ? 1 : 3" width="2" color.a="0.5" 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" width="3" color="bright_cyan" smooth="true"/>
						<ui:for id="i" first="0" last=":num_filters - 1">
							<ui:with pointer="drag" color="graph_marker_cycle" hover.color="graph_marker_cycle" bcolor="graph_marker_cycle" hover.bcolor="graph_marker_cycle" x.editable="true" y.editable="true" z.editable="true">
								<dot
									ui:id="filter_dot_${i}"
									x.id="f_${i}"
									y.id="g_${i}"
									z.id="q_${i}"
									size="1 + 2*:_ui_filter_point_thickness"
									hover.size="1 + 2*:_ui_filter_point_thickness"
									color.hue=":hue_${i}"
									hover.color.hue=":hue_${i}"
									bcolor.hue=":hue_${i}"
									hover.bcolor.hue=":hue_${i}"
									visibility=":fv_${i}"
									x.astep="1"
									y.astep="1"/>
							</ui:with>
						</ui:for>

						<!-- 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 ui:id="para_eq_ox" min="10" max="24000" color="graph_prim" angle="0.0" log="true" visibility="false"/>
						<axis ui:id="para_eq_oy" min="-48 db / :zoom" max="48 db * :zoom" color="graph_prim" 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>

						<!-- Button quantize -->
						<embed oy="4" start.x="18000" start.y="20" end.x="18000" end.y="44" valign="1" halign="0" alpha="0">
							<button id="quant" font.name="lsp-icons" font.size="12" size="24" text="icons.other.quantize_note"/>
						</embed>

						<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:for id="i" first="0" last=":num_filters - 1">
							<ui:with ox="0" oy="2" y="1" valign="-1" color="graph_marker_cycle" visibility="false" pad.h="4" font.bold="true">
								<text ui:id="filter_note_${i}" x=":f_${i}" halign="(:f_${i} lt 500) ? 1 : -1" text.halign="(:f_${i} lt 500) ? -1 : 1" color.hue=":hue_${i}"/>
							</ui:with>
						</ui:for>

					</graph>
				</group>

				<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>
			</hbox>
		</cell>

		<!-- Signal meters -->
		<hbox spacing="4" bg.color="bg" vexpand="true">

			<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" vexpand="true">
			<group text="groups.signal" expand="true" ipad.h="6" ipad.v="8">
				<grid rows="4" cols="2" spacing="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>

					<knob id="frqs" scolor="mid" pad.r="4"/>
					<vbox vfill="false">
						<label text="labels.chan.pitch" halign="0"/>
						<value id="frqs" 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" spacing="4" pad.v="8">
						<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>

		<!-- shmlink box -->
		<cell cols="2">
			<vbox vreduce="true" bg.color="bg_schema">
				<shmlink id="return" pad.v="4"/>
				<shmlink id="send" pad.b="4"/>
			</vbox>
		</cell>

		<!-- bottom line -->
		<cell cols="3">
			<hbox spacing="4" vreduce="true" bg.color="bg_schema" pad.h="6">
				<button ui:id="filter_inspect_reset" text="labels.chan.inspect" ui:inject="Button_orange" pad.v="4"/>
				<button id="insp_on" text="labels.auto" ui:inject="Button_orange" pad.v="4"/>

				<knob id="insp_r" scale.size="3" scolor="orange" size="10" pad.l="6"/>
				<value id="insp_r" width.min="48" same_line="true" fill="true" halign="1" pad.r="12"/>

				<void hexpand="true"/>

				<label text="labels.mode"/>
				<combo id="mode" pad.v="4"/>
				<label text="labels.decramp" pad.l="8"/>
				<combo id="decramp" pad.v="4"/>
			</hbox>
		</cell>

		<cell cols="3">
			<cgroup id="fsel" pointer="${(:num_filters igt 8) ? 'hand' : 'arrow'}">
				<!-- 4 blocks of filters -->
				<ui:for id="f" first="0" last=":num_blocks - 1">
					<grid ui:group="filters" transpose="true" rows="9" cols="25" spacing="0">
						<ui:with expand="false">
							<label text="labels.specials.num" fill="true" halign="0"/>
							<label text="labels.filter" fill="true" halign="0" pad.b="6"/>
							<label text="labels.mode" fill="true" halign="0" pad.b="6"/>
							<label text="labels.slope" fill="true" halign="0" pad.b="6"/>
							<label text="labels.controls" fill="true" halign="0" pad.b="6"/>
							<label text="labels.freq_gain" halign="0" pad.h="6" pad.t="6"/>
							<label text="labels.hz_db" halign="0" pad.t="3"/>
							<cell rows="2"><label text="labels.q_width" halign="0"/></cell>
						</ui:with>

						<!-- Filters -->
						<ui:for id="i" first=":f*8" last=":f*8+7">
							<ui:set id="ch" value="_${i}"/>
							<ui:with ui:group="grp_filter${ch}">
								<cell rows="9" bg.color="bg" pad.r="2" pad.l="2" expand="false" pad.t="6" pad.b="6">
									<vsep/>
								</cell>
								<ui:with expand="true" bright="(:ft${ch} igt 0) ? 1 : 0.75" bg.bright="(:ft${ch} igt 0) ? 1.0 : :const_bg_darken">
									<cell cols="2"><label text="${:i+1}" pad="6"/></cell>
									<cell cols="2" fill="true">
										<combo ui:id="filter_type${ch}" id="ft${ch}" fill="true" pad.l="6" pad.r="6" pad.b="6"/>
									</cell>
									<cell cols="2" fill="true">
										<combo ui:id="filter_mode${ch}" id="fm${ch}" fill="true" pad.h="6" expand="true" pad.b="6"/>
									</cell>
									<cell cols="2" fill="true">
										<combo ui:id="filter_slope${ch}" id="s${ch}" fill="true" pad.h="6" expand="true" pad.b="6"/>
									</cell>
									<cell cols="2" fill="true">
										<hbox pad.b="6">
											<button ui:id="filter_inspect${ch}" text="labels.chan.I_nspect" ui:inject="Button_orange_8" pad.h="6" fill="true" expand="true"/>
											<button ui:id="filter_solo${ch}" id="xs${ch}" text="labels.chan.S_olo" ui:inject="Button_green_8" pad.r="6" fill="true" expand="true"/>
											<button ui:id="filter_mute${ch}" id="xm${ch}" text="labels.chan.M_ute" ui:inject="Button_red_8" pad.r="6" fill="true" expand="true"/>
										</hbox>
									</cell>

									<knob ui:id="filter_freq${ch}" id="f${ch}" scolor="(:ft${ch} igt 0) ? 'cycle' : 'cycle_inactive'" scolor.hue=":hue${ch}" size="20" pad.t="6"/>
									<value id="f${ch}" width.min="40" detailed="false" precision="1" pad.t="3"/>

									<knob ui:id="filter_q${ch}" id="q${ch}" scolor="(:ft${ch} igt 0) ? 'cycle' : 'cycle_inactive'" scolor.hue=":hue${ch}" size="20" pad.t="6"/>
									<value id="q${ch}" width.min="40" detailed="false" pad.t="3" pad.b="6"/>

									<knob ui:id="filter_gain${ch}" id="g${ch}" scolor="(:ft${ch} igt 0) ? 'cycle' : 'cycle_inactive'" scolor.hue=":hue${ch}" size="20" pad.t="6"/>
									<value id="g${ch}" width.min="40" detailed="false" pad.t="3"/>

									<knob ui:id="filter_width${ch}" id="w${ch}" scolor="(:ft${ch} igt 8) ? 'cycle' : 'cycle_inactive'" scolor.hue=":hue${ch}" size="20" pad.t="6"/>
									<value id="w${ch}" bright="(:ft${ch} igt 8) ? 1 : 0.75" width.min="40" detailed="false" pad.t="3" pad.b="6"/>
								</ui:with>
							</ui:with>
						</ui:for>
					</grid>
				</ui:for>
			</cgroup>
		</cell>
	</grid>
</plugin>
