<plugin resizable="true">
	<ui:eval id="is_sidechain" value="(ex :sc) or (ex :sc_l) or (ex :sc_r)"/>

	<vbox>
		<!-- Top part -->
		<grid rows="3" cols="2" hspacing="4">
			<group ui:inject="GraphGroup" ipadding="0" expand="true" fill="true" text="labels.graphs.time">
				<!-- Time graph -->
				<graph width.min="560" height.min="280" expand="true">
					<origin hpos="1" vpos="-1" visible="false"/>

					<!-- Gray grid -->
					<marker v="-12 db" ox="1" oy="0" color="graph_alt_1"/>
					<marker v="-36 db" ox="1" oy="0" color="graph_alt_1"/>
					<marker v="-60 db" ox="1" oy="0" color="graph_alt_1"/>
					<ui:for id="t" first="0" last="3">
						<marker v="${t}.5" ox="0" oy="1" color="graph_alt_1"/>
					</ui:for>
					<!-- Yellow grid -->
					<marker v="-24 db" ox="1" oy="0" color="graph_sec"/>
					<ui:for id="t" first="1" last="3">
						<marker v="${t}" ox="0" oy="1" color="graph_sec"/>
					</ui:for>

					<!-- Axis -->
					<axis min="0" max="4" color="graph_prim" angle="1.0" log="false" visibility="false"/>
					<axis min="-48 db" max="12 db" color="graph_prim" angle="0.5" log="true" visibility="false"/>

					<!-- Baseline -->
					<marker v="0 db" ox="1" oy="0" color="graph_prim" width="2"/>

					<!-- Meshes -->
					<mesh id="ig_l" width="0" color="left_in" fcolor="left_in" fcolor.a="0.9" fill="true" visibility=":igv_l"/>
					<mesh id="ig_r" width="0" color="right_in" fcolor="right_in" fcolor.a="0.9" fill="true" visibility=":igv_r"/>
					<mesh id="og_l" width="1" color="left" color.a="0.5" visibility=":ogv_l"/>
					<mesh id="og_r" width="1" color="right" color.a="0.5" visibility=":ogv_r"/>
					<mesh id="scg_l" width="2" color="sidechain" color.a="0.3" visibility=":scgv_l"/>
					<mesh id="scg_r" width="2" color="sidechain" color.a="0.3" visibility=":scgv_r"/>
					<mesh id="grg_l" width="2" color="bright_blue" visibility=":grgv_l" fcolor="bright_blue" color.a="0.5" fcolor.a="0.9" fill="true"/>
					<mesh id="grg_r" width="2" color="bright_blue" visibility=":grgv_r" fcolor="bright_blue" color.a="0.5" fcolor.a="0.9" fill="true"/>

					<!-- Markers -->
					<marker id="th" editable="true" width="3" pointer="vsize" color="threshold" hcolor="threshold" lcolor="threshold" hlcolor="threshold" ox="1" oy="0" lborder="50" hlborder="50" color.a="0.1" hcolor.a="0.0" lcolor.a="1.0" hlcolor.a="0.7"/>

					<!-- Text -->
					<ui:attributes x="4" halign="1" valign="-1">
						<text y="12 db" text="graph.values.x:db" text:value="12"/>
						<text y="0 db" text="0"/>
						<text y="-12 db" text="-12"/>
						<text y="-24 db" text="-24"/>
						<text y="-36 db" text="-36"/>
						<text y="-48 db" text="graph.units.s" valign="1"/>
					</ui:attributes>
					<ui:for id="t" first="0" last="3">
						<text x="${t}" y="-48 db" text="${t}" halign="-1" valign="1"/>
						<text x="${t}.5" y="-48 db" text="${t}.5" halign="-1" valign="1"/>
					</ui:for>
				</graph>
			</group>

			<grid rows="3" cols="4" hfill="false" hexpand="false" hspacing="4">
				<ui:with bg.color="bg_schema">
					<label text="labels.sc.SC" padding="4"/>
					<label text="labels.gain_" padding="4"/>
					<label text="labels.chan.in" padding="4"/>
					<label text="labels.chan.out" padding="4"/>

					<grid rows="2" cols="2" fill="false" hspacing="2">
						<button id="scgv_l" size="10" ui:inject="Button_orange" led="true"/>
						<button id="scgv_r" size="10" ui:inject="Button_orange" led="true"/>
					</grid>

					<grid rows="2" cols="2" fill="false" hspacing="2">
						<button id="grgv_l" size="10" ui:inject="Button_blue" led="true"/>
						<button id="grgv_r" size="10" ui:inject="Button_blue" led="true"/>
					</grid>

					<grid rows="2" cols="2" fill="false" hspacing="2">
						<button id="igv_l" size="10" ui:inject="Button_left" led="true"/>
						<button id="igv_r" size="10" ui:inject="Button_right" led="true"/>
					</grid>

					<grid rows="2" cols="2" fill="false" hspacing="2">
						<button id="ogv_l" size="10" ui:inject="Button_left" led="true"/>
						<button id="ogv_r" size="10" ui:inject="Button_right" led="true"/>
					</grid>
				</ui:with>

				<!-- Sidechain signal meter -->
				<ledmeter vexpand="true" height.min="256" angle="1">
					<ledchannel id="sclm_l" min="-48 db" max="0 db" log="true" type="peak" activity=":scgv_l" value.color="sidechain_1"/>
					<ledchannel id="sclm_r" min="-48 db" max="0 db" log="true" type="peak" activity=":scgv_r" value.color="sidechain_2"/>
				</ledmeter>

				<!-- Gain signal meter -->
				<ledmeter vexpand="true" height.min="256" angle="1">
					<ledchannel id="grlm_l" min="-48 db" max="0 db" log="true" type="peak" balance="0 db" balance.visibility="true" activity=":grgv_l" value.color="blue"/>
					<ledchannel id="grlm_r" min="-48 db" max="0 db" log="true" type="peak" balance="0 db" balance.visibility="true" activity=":grgv_r" value.color="blue"/>
				</ledmeter>

				<!-- Input signal meter -->
				<ledmeter vexpand="true" height.min="256" angle="1">
					<ledchannel id="ilm_l" min="-48 db" max="0 db" log="true" type="rms_peak" peak.visibility="true" activity=":igv_l" value.color="left_in"/>
					<ledchannel id="ilm_r" min="-48 db" max="0 db" log="true" type="rms_peak" peak.visibility="true" activity=":igv_r" value.color="right_in"/>
				</ledmeter>

				<!-- Output signal meter -->
				<ledmeter vexpand="true" height.min="256" angle="1">
					<ledchannel id="olm_l" min="-48 db" max="0 db" log="true" type="rms_peak" peak.visibility="true" activity=":ogv_l" value.color="left"/>
					<ledchannel id="olm_r" min="-48 db" max="0 db" log="true" type="rms_peak" peak.visibility="true" activity=":ogv_r" value.color="right"/>
				</ledmeter>
			</grid>

			<cell cols="2">
				<void bg.color="bg" vexpand="false" fill="false" pad.v="2"/>
			</cell>
			<cell cols="2">
				<hbox spacing="4" bg.color="bg_schema" pad.h="6">

					<label text="labels.mode:"/>
					<combo id="mode" pad.r="12" pad.v="4"/>
					<label text="labels.Over_Sampling:"/>
					<combo id="ovs" pad.r="12"/>
					<label text="labels.dither:"/>
					<combo id="dith" pad.r="12"/>
					<void hexpand="true"/>

					<button ui:id="premix_trigger" id="showpmx" text="labels.premix" size="22"/>
					<button id="alr" height="22" width="48" text="labels.alr" ui:inject="Button_yellow"/>
					<button id="pause" height="22" width="48" text="labels.pause" ui:inject="Button_green"/>
					<button id="clear" height="22" width="48" text="labels.clear" ui:inject="Button_red" pad.r="2"/>

					<vsep pad.h="2" bg.color="bg" reduce="true"/>
					<shmlink id="link" pad.l="2"/>
				</hbox>
			</cell>

		</grid>

		<!-- Separator -->
		<void bg.color="bg" fill="true" pad.v="2" reduce="true"/>

		<!-- Bottom part -->
		<hbox spacing="4" vreduce="true">
			<!-- ALR -->
			<group text="groups.alr">
				<grid rows="3" cols="4">
					<ui:with pad.h="6" fill="false" hexpand="true" vreduce="true">
						<label text="labels.attack"/>
						<label text="labels.release"/>
						<label text="labels.knee"/>
						<label text="labels.smooth"/>
					</ui:with>

					<ui:with pad.t="5" pad.b="4">
						<knob id="alr_at" scolor="attack"/>
						<knob id="alr_rt" scolor="release"/>
						<knob id="knee"/>
						<knob id="smooth"/>
					</ui:with>

					<value id="alr_at"/>
					<value id="alr_rt"/>
					<value id="knee"/>
					<value id="smooth"/>
				</grid>
			</group>

			<!-- Limiter setup -->
			<group text="groups.plug.limiter" ipadding="0">
				<grid rows="3" cols="10">
					<label text="labels.sc.sc_preamp" pad.h="6" pad.t="6" fill="false" hexpand="true" vreduce="true"/>
					<cell rows="3" hreduce="true" pad.h="2"><vsep/></cell>
					<label text="labels.sc.lookahead" pad.h="6" pad.t="6" fill="false" hexpand="true" vreduce="true"/>
					<cell rows="3" hreduce="true" pad.h="2"><vsep/></cell>
					<label text="labels.threshold" pad.h="6" pad.t="6" fill="false" hexpand="true" vreduce="true"/>
					<cell rows="3" hreduce="true" pad.h="2"><vsep/></cell>
					<ui:with pad.h="6" pad.t="6" fill="false" hexpand="true" vreduce="true">
						<label text="labels.attack"/>
						<label text="labels.release"/>
					</ui:with>
					<cell rows="3" hreduce="true" pad.h="2"><vsep/></cell>
					<label text="labels.stereo_link" pad.h="6" pad.t="4" fill="false" hexpand="true" vreduce="true"/>

					<hbox fill="false">
						<knob id="scp" pad.t="1"/>
						<value id="scp" width.min="32" pad.l="4"/>
					</hbox>

					<knob id="lk" pad.t="5" pad.b="4" pad.h="6"/>
					<hbox fill="false">
						<knob id="th" scolor="threshold" pad.t="1"/>
						<value id="th" width.min="32" pad.l="4"/>
					</hbox>
					<ui:with pad.t="5" pad.b="4" pad.h="6">
						<knob id="at" scolor="attack"/>
						<knob id="rt" scolor="release"/>
						<knob id="slink" scolor="balance"/>
					</ui:with>

					<combo id="extsc" pad.h="6" height="18"/>

					<value id="lk" pad.b="6" pad.h="6"/>
					<button id="boost" pad.h="6" height="18" width="70" text="labels.boost_" ui:inject="Button_violet_8"/>
					<ui:with pad.b="6" pad.h="6">
						<value id="at"/>
						<value id="rt"/>
						<value id="slink"/>
					</ui:with>
				</grid>
			</group>

			<!-- Signal control -->
			<group text="groups.signal">
				<grid rows="3" cols="2">
					<ui:with pad.h="6" fill="false" hexpand="true" vreduce="true">
						<label text="labels.input"/>
						<label text="labels.output"/>
					</ui:with>
					<ui:with pad.t="5" pad.b="4">
						<knob id="g_in"/>
						<knob id="g_out"/>
					</ui:with>

					<value id="g_in"/>
					<value id="g_out"/>
				</grid>
			</group>
		</hbox>
	</vbox>

	<!-- Premix overlay -->
	<overlay id="showpmx" trigger="premix_trigger" hpos="1" vpos="1" halign="-1" valign="1" ipadding.t="4">
		<group text="groups.premix" vexpand="false" ipadding="0">
			<grid rows="3" cols="${(:is_sidechain) ? 8 : 5}" spacing="0" bg.color="bg_schema" transpose="true">
				<ui:if test=":is_sidechain">
					<label text="labels.premix.in_to_sc" pad.h="6" pad.v="4"/>
					<knob id="in2sc"/>
					<value id="in2sc" pad.h="6" pad.v="4"/>
				</ui:if>

				<label text="labels.premix.in_to_link" pad.h="6" pad.v="4"/>
				<knob id="in2lk"/>
				<value id="in2lk"/>

				<cell rows="3"><vsep pad.h="2" bg.color="bg" reduce="true"/></cell>

				<ui:if test=":is_sidechain">
					<label text="labels.premix.sc_to_in" pad.h="6" pad.v="4"/>
					<knob id="sc2in"/>
					<value id="sc2in" pad.h="6" pad.v="4"/>

					<label text="labels.premix.sc_to_link" pad.h="6" pad.v="4"/>
					<knob id="sc2lk"/>
					<value id="sc2lk" pad.h="6" pad.v="4"/>

					<cell rows="3"><vsep pad.h="2" bg.color="bg" reduce="true"/></cell>
				</ui:if>

				<label text="labels.premix.link_to_in" pad.h="6" pad.v="4"/>
				<knob id="lk2in"/>
				<value id="lk2in" pad.h="6" pad.v="4"/>

				<label text="labels.premix.link_to_sc" pad.h="6" pad.v="4"/>
				<knob id="lk2sc"/>
				<value id="lk2sc" pad.h="6" pad.v="4"/>
			</grid>
		</group>
	</overlay>
</plugin>
