<?xml version="1.0" encoding="utf-8" standalone="yes"?>

<?xml-stylesheet href="./_c74_ref.xsl" type="text/xsl"?>

<!--This is an automatically generated file. DO NOT EDIT THIS FILE DIRECTLY. Rather, use the _ref.xml files found in the 'edits' folder.-->
<c74object name="mc.sah~" module="" category="Multichannel">
	<digest>
		Sample and hold a signal (multichannel)
	</digest>
	<description>
		Use <o>sah~</o> to capture (&quot;sample&quot;) and output (&quot;hold&quot;) a value from an input signal whenever a trigger signal satisfies a threshold value according to one of several trigger conditions. The default trigger mode (Ascending) requires the signal to go from being at or below the threshold value to above it. At the moment the trigger condition is satisfied, the input signal is sampled and &quot;held&quot; until the trigger condition is satisfied again, at which point the input is sampled again. Generally this allows one signal to be synchronized to the behavior of another.
	</description>
	<!--METADATA-->
	<metadatalist>
		<metadata name="author">
			Cycling '74
		</metadata>
		<metadata name="tag">
			MSP Generators
		</metadata>
	</metadatalist>
	<!--INLETS-->
	<inletlist>
		<inlet id="0" type="signal">
			<digest>
				Values To Sample, double Sets Trigger Threshold
			</digest>
			<description>
				TEXT_HERE
			</description>
		</inlet>
		<inlet id="1" type="signal">
			<digest>
				Trigger Input
			</digest>
			<description>
				TEXT_HERE
			</description>
		</inlet>
	</inletlist>
	<!--OUTLETS-->
	<outletlist>
		<outlet id="0" type="signal">
			<digest>
				Output
			</digest>
			<description>
				TEXT_HERE
			</description>
		</outlet>
	</outletlist>
	<!--ARGUMENTS-->
	<objarglist>
		<objarg name="initial-trigger-value" optional="1" default="0" type="number">
			<digest>
				Initial trigger value
			</digest>
			<description />
		</objarg>
	</objarglist>
	<!--MESSAGES-->
	<methodlist>
		<method name="float">
			<arglist>
				<arg name="ARG_NAME_0" type="float" optional="0" />
			</arglist>
			<digest>
				Set trigger threshold value
			</digest>
			<description>
				TEXT_HERE
			</description>
		</method>
		<method name="signal">
			<arglist />
			<digest>
				Function depends on inlet
			</digest>
			<description>
				In left inlet: A signal to be sampled. When the trigger signal (in the right inlet) satisfies the current trigger condition, the signal in the left inlet is sampled and its value is sent out as a constant signal value.
				<br />
				<br />
				In right inlet: The trigger signal.
			</description>
		</method>
	</methodlist>
	<!--ATTRIBUTES-->
	<attributelist>
		<attribute name="duration" get="1" set="1" type="atom_long" size="1">
			<digest>
				Output Duration in Samples
			</digest>
			<description>
				Normally the signal output of <o>sah~</o> remains constant. With a non-zero value for <at>duration</at> any new non-zero value will remain constant for a specified number samples, after which it will be 0.
			</description>
			<attributelist>
				<attribute name="default" get="1" set="1" type="atom_long" size="1" value="0" />
				<attribute name="label" get="1" set="1" type="symbol" size="1" value="Output Duration in Samples" />
			</attributelist>
		</attribute>
		<attribute name="thresh" get="1" set="1" type="float" size="1">
			<digest>
				Threshold Value
			</digest>
			<description>
				Sets the value of the trigger signal used to cause the input signal to be sampled and output.
			</description>
			<attributelist>
				<attribute name="default" get="1" set="1" type="float" size="1" value="0." />
				<attribute name="label" get="1" set="1" type="symbol" size="1" value="Threshold Value" />
			</attributelist>
		</attribute>
		<attribute name="triggermode" get="1" set="1" type="int" size="1">
			<digest>
				Trigger Mode
			</digest>
			<description>
				Determines how <o>sah~</o> analyzes the trigger signal to cause the input to be sampled and output. The classic (and default) <at>triggermode</at> is 0 (Ascending).
			</description>
			<attributelist>
				<attribute name="default" get="1" set="1" type="int" size="1" value="0" />
				<attribute name="enumvals" get="1" set="1" type="atom" size="7">
					<enumlist>
						<enum name="Ascending">
							<digest>
							</digest>
							<description>
								Ascending mode detects the trigger signal passing from below to above the threshold value. Useful with increasing ramps (such as <o>phasor~</o> with a positive frequency).
							</description>
						</enum>
						<enum name="Descending">
							<digest>
							</digest>
							<description>
								Descending mode detects trigger signal passing from above to below the threshold value. Useful with decreating ramps (such as <o>phasor~</o> with a negative frequency).
							</description>
						</enum>
						<enum name="Ascending or Descending">
							<digest>
							</digest>
							<description>
								Ascending + Descending mode detects trigger signal passing from below to above the threshold value <i>or</i> passing from above to below the threshold value. This mode may produce unexpected results with a phasor but might be more appropriate for a continuous trigger input such as a sine wave.
							</description>
						</enum>
						<enum name="Equals">
							<digest>
								TEXT_HERE
							</digest>
							<description>
								Equals mode detects an exact value in the trigger signal value. This mode is not recommended for continuous functions that may never reach a specific value, but could be useful to detect impulses or other signals where a specific value is expected.
							</description>
						</enum>
						<enum name="Zero-to-Nonzero">
							<digest>
							</digest>
							<description>
								Zero-to-Nonzero mode detects a trigger signal that goes from a zero value to a non-zero value. This could be useful to detect the start of a ramp or incoming audio. The value of <at>thresh</at> is ignored in this mode.
							</description>
						</enum>
						<enum name="Nonzero-to-Zero">
							<digest>
								TEXT_HERE
							</digest>
							<description>
								Nonzero-to-zero mode detects a trigger signal that goes from a non-zero value to a zero value. This could be useful to detect a signal turning off. The value of <at>thresh</at> is ignored in this mode.
							</description>
						</enum>
						<enum name="Phase">
							<digest>
							</digest>
							<description>
								Phase mode treats the threshold value as a phase value using the same phase detection algorithm as the <o>what~</o> object. In Phase mode, <o>sah~</o> detects resets in the output of the <o>phasor~</o> object and defines those as triggers for a threshold value of 0. Phase mode works with both positive and negative <o>phasor~</o> frequencies.
							</description>
						</enum>
					</enumlist>
				</attribute>
				<attribute name="label" get="1" set="1" type="symbol" size="1" value="Trigger Mode" />
				<attribute name="style" get="1" set="1" type="symbol" size="1" value="enumindex" />
			</attributelist>
		</attribute>
	</attributelist>
	<!--EXAMPLE-->
	<examplelist>
		<example img="sah~.png" caption="Hold the signal value constant until the next trigger" />
	</examplelist>
	<!--SEEALSO-->
	<seealsolist>
		<seealso name="gate~" />
		<seealso name="phasor~" />
		<seealso name="stash~" />
		<seealso name="thresh~" />
		<seealso name="what~" />
	</seealsolist>
	<mcwrapper>
		<mcwrappermethod name="applymessages" />
		<mcwrappermethod name="applynvalues" />
		<mcwrappermethod name="applyvalues" />
		<mcwrappermethod name="decide" />
		<mcwrappermethod name="deviate" />
		<mcwrappermethod name="ease.in_back" />
		<mcwrappermethod name="ease.in_bounce" />
		<mcwrappermethod name="ease.in_circular" />
		<mcwrappermethod name="ease.in_cubic" />
		<mcwrappermethod name="ease.in_elastic" />
		<mcwrappermethod name="ease.in_exponential" />
		<mcwrappermethod name="ease.in_out_back" />
		<mcwrappermethod name="ease.in_out_bounce" />
		<mcwrappermethod name="ease.in_out_circular" />
		<mcwrappermethod name="ease.in_out_cubic" />
		<mcwrappermethod name="ease.in_out_elastic" />
		<mcwrappermethod name="ease.in_out_exponential" />
		<mcwrappermethod name="ease.in_out_quadratic" />
		<mcwrappermethod name="ease.in_out_quartic" />
		<mcwrappermethod name="ease.in_out_quintic" />
		<mcwrappermethod name="ease.in_out_sine" />
		<mcwrappermethod name="ease.in_quadratic" />
		<mcwrappermethod name="ease.in_quartic" />
		<mcwrappermethod name="ease.in_quintic" />
		<mcwrappermethod name="ease.in_sine" />
		<mcwrappermethod name="ease.linear" />
		<mcwrappermethod name="ease.out_back" />
		<mcwrappermethod name="ease.out_bounce" />
		<mcwrappermethod name="ease.out_circular" />
		<mcwrappermethod name="ease.out_cubic" />
		<mcwrappermethod name="ease.out_elastic" />
		<mcwrappermethod name="ease.out_quadratic" />
		<mcwrappermethod name="ease.out_quartic" />
		<mcwrappermethod name="ease.out_quintic" />
		<mcwrappermethod name="ease.out_sine" />
		<mcwrappermethod name="exponential" />
		<mcwrappermethod name="generate" />
		<mcwrappermethod name="harmonic" />
		<mcwrappermethod name="increment" />
		<mcwrappermethod name="randomrange" />
		<mcwrappermethod name="replicatenvalues" />
		<mcwrappermethod name="replicatevalues" />
		<mcwrappermethod name="scaledexponential" />
		<mcwrappermethod name="setvalue" />
		<mcwrappermethod name="setvaluerange" />
		<mcwrappermethod name="smoothstep" />
		<mcwrappermethod name="spread" />
		<mcwrappermethod name="spreadexclusive" />
		<mcwrappermethod name="spreadincludefirst" />
		<mcwrappermethod name="spreadincludesecond" />
		<mcwrappermethod name="spreadinclusive" />
		<mcwrappermethod name="subharmonic" />
		<mcwrapperattr name="busymapname" />
		<mcwrapperattr name="bz" />
		<mcwrapperattr name="bzname" />
		<mcwrapperattr name="chans" />
		<mcwrapperattr name="fun" />
		<mcwrapperattr name="initialvalues" />
		<mcwrapperattr name="op" />
		<mcwrapperattr name="replicate" />
		<mcwrapperattr name="target" />
		<mcwrapperattr name="usebusymap" />
		<mcwrapperattr name="values" />
		<mcwrapperattr name="voiceprob" />
		<mcwrapperattr name="zero" />
	</mcwrapper>
</c74object>
