<?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="stash~" module="" category="">
	<digest>
		Store and Recall Audio Signal Values
	</digest>
	<description>
		Use the <o>stash~</o> object to store and recall a buffer of signal values. In one mode, <o>stash~</o> can perform sample-and-hold operations on an input signal but unlike the <o>sah~</o>, <o>stash~</o> reads from a buffer rather than holds a single sample. <o>stash~</o> can be a simple interpolating lookup table or audio-rate step sequencer.
	</description>
	<!--METADATA-->
	<metadatalist>
		<metadata name="author">
			Cycling '74
		</metadata>
		<metadata name="tag">
			MSP
		</metadata>
	</metadatalist>
	<!--INLETS-->
	<inletlist>
		<inlet id="0" type="signal, float">
			<digest>
				Input
			</digest>
			<description>
				Values from a signal are captured when <o>store~</o> triggers a write. Float values are written to the object's buffer at the current write index.
			</description>
		</inlet>
		<inlet id="1" type="signal, float">
			<digest>
				Sample Trigger
			</digest>
			<description>
				In the second inlet, a signal can trigger a sample capture. A float sets the threshold level for signal capture.
			</description>
		</inlet>
		<inlet id="2" type="signal, float">
			<digest>
				Advance Trigger or Index
			</digest>
			<description>
				In the third inlet, a signal triggers advancing the playback to the next value in the buffer according to the current playback direction, or serves as an index into the buffer for table-based playback. A float sets the threshold level for advancing to the next value.
			</description>
		</inlet>
		<inlet id="3" type="signal, float">
			<digest>
				Write Index
			</digest>
			<description>
				In the right inlet, both a signal and float set the position (write index) where the next input value will be stored.
			</description>
		</inlet>
	</inletlist>
	<!--OUTLETS-->
	<outletlist>
		<outlet id="0" type="signal">
			<digest>
				Output
			</digest>
			<description>
				The left outlet produces a signal of stepped or interpolated values from the buffer.
			</description>
		</outlet>
		<outlet id="1" type="signal">
			<digest>
				Index
			</digest>
			<description>
				The right outlet outputs the buffer index for the current value of the left outlet.
			</description>
		</outlet>
	</outletlist>
	<!--ARGUMENTS-->
	<objarglist>
		<objarg id="0" name="sample-thresh" type="float" optional="1">
			<digest>
				Sampling Threshold
			</digest>
			<description>
				If present, a <m>float</m> sets the initial threshold value for writing a signal value into the buffer (<at>samplelevel</at>).
			</description>
		</objarg>
		<objarg id="1" name="advance-thresh" type="float" optional="1">
			<digest>
				Advance Threshold
			</digest>
			<description>
				If a second <m>float</m> argument is present, it sets the initial threshold value for advancing to the next value in the buffer (<at>advancelevel</at>).
			</description>
		</objarg>
	</objarglist>
	<!--MESSAGES-->
	<methodlist>
		<method name="bang">
			<arglist />
			<digest>
				Function depends on inlet
			</digest>
			<description>
				In left inlet: the <m>bang</m> message does nothing.
				<br />
				In second inlet: if there is a signal connected to the left inlet and there is <i>not</i> a signal connected to the second inlet, a <m>bang</m> in the second inlet causes the first sample of the next signal vector to be captured according to the current <at>writemode</at>.				<br />
				In third inlet: if there is not a signal connected to the third inlet, a <m>bang</m> advances the output.
				<br />
				In right inlet: advances the index used for writing samples either for a <m>float</m> in the left inlet or when there isn't a signal connected to the right inlet.
			</description>
		</method>
		<method name="int">
			<arglist>
				<arg name="ARG_NAME_0" type="int" optional="0" />
			</arglist>
			<digest>
				Converted to <m>float</m> 
			</digest>
			<description>
				TEXT_HERE
			</description>
		</method>
		<method name="float">
			<arglist>
				<arg name="ARG_NAME_0" type="float" optional="0" />
			</arglist>
			<digest>
				Function depends on inlet
			</digest>
			<description>
				In left inlet: the value is written to the buffer at the current write index.
				<br />
				In second inlet: sets the threshold value for capturing signals connected to the left inlet (<at>samplelevel</at>).
				<br />
				In third inlet: sets the threshold value for a signal connected to the third inlet to advance the output (<at>advancelevel</at>).
				<br />
				In right inlet: if a signal is <i>not</i> connected to this inlet, sets the current index for writing into the buffer for signal capture. A number in the right inlet also sets the index used to store a <m>float</m> sent to the left inlet.
			</description>
		</method>
		<method name="list">
			<arglist>
				<arg name="ARG_NAME_0" type="list" optional="0" />
			</arglist>
			<digest>
				In left inlet: sets the buffer contents and size
			</digest>
			<description>
				<m>list</m> received in the left inlet sets the contents of the buffer and sets its size to the length of the list. The maximum length of the list that will be used is set by the <at>maxsize</at> attribute.
			</description>
		</method>
		<method name="signal">
			<arglist />
			<digest>
				Function depends on inlet
			</digest>
			<description>
				In left inlet: signal values are captured to the buffer
				<br />
				In second inlet: used to trigger capturing values from the signal connected to the left inlet
				<br />
				In third inlet: depending on the setting of the <at>mode</at> attribute, a connected signal triggers advancing to the next item in the output buffer or is used as an index into the buffer to determine the output.
				<br />
				In right inlet: sets the write index used when capturing signal values.
			</description>
		</method>
	</methodlist>
	<!--ATTRIBUTES-->
	<attributelist>
		<attribute name="advancelevel" get="1" set="1" type="float" size="1">
			<digest>
				Advance Level
			</digest>
			<description>
				Sets the signal value that will trigger advancing the output to the next value in the buffer. The <at>advancelevel</at> value applies when the <at>advancetriggermode</at> attribute is set to Ascending, Descending, or Ascending or Descending).
			</description>
			<attributelist>
				<attribute name="label" get="1" set="1" type="symbol" size="1" value="Advance Level" />
			</attributelist>
		</attribute>
		<attribute name="advancetriggermode" get="1" set="1" type="int" size="1">
			<digest>
				Advance Trigger Mode
			</digest>
			<description>
				Determines how a signal connected to the third inlet is interpreted for changing the signal output of <o>stash~</o> when it is advancing to the next value in the buffer when <at>mode</at> is set to 0 (<m>Next</m>).
			</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>
								Detect value in an ascending ramp
							</digest>
							<description>
								The output advances when the previous sample of the input is less than or equal to the <at>advancelevel</at> and the current sample is greater than the <at>advancelevel</at>.
							</description>
						</enum>
						<enum name="Descending">
							<digest>
								Detect value in an descending ramp
							</digest>
							<description>
								The output advances when the previous sample of the input is greater than or equal to the <at>advancelevel</at> and the current sample is less than the <at>advancelevel</at>.
							</description>
						</enum>
						<enum name="Ascending or Descending">
							<digest>
								Detect value in an asecending or descending ramp
							</digest>
							<description>
								The output advances if either the ascending or descending condition is true. This mode is useful for detecting ramps in phasors with either positive and negative frequencies.
							</description>
						</enum>
						<enum name="Equals">
							<digest>
								Detect exact value
							</digest>
							<description>
								The output advances if the input is exactly equal to the current sample. This mode is not recommend for phasor ramps since it is unlikely the ramp will output a sample exactly equal to any particular value. The value of <at>advancelevel</at> does not apply in this mode.
							</description>
						</enum>
						<enum name="Zero-to-Nonzero">
							<digest>
								Detect zero to non-zero transition
							</digest>
							<description>
								The output advances if the previous sample is zero and the current sample is non-zero. The value of <at>advancelevel</at> does not apply in this mode.
							</description>
						</enum>
						<enum name="Nonzero-to-Zero">
							<digest>
								Detect non-zero to zero transition
							</digest>
							<description>
								The output advances if the previous sample is non-zero and the current sample is zero. The value of <at>advancelevel</at> does not apply in this mode.
							</description>
						</enum>
						<enum name="Phase">
							<digest>
							</digest>
							<description>
								Phase mode treats the value of <at>advancelevel</at> as a phase value using the same phase detection algorithm as the <o>what~</o> object. In Phase mode, <o>stash~</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="Advance Trigger Mode" />
				<attribute name="style" get="1" set="1" type="symbol" size="1" value="enumindex" />
			</attributelist>
		</attribute>
		<attribute name="dir" get="1" set="1" type="int" size="1">
			<digest>
				Advance Direction
			</digest>
			<description>
				Sets the direction in which <o>stash</o> advances through its buffer when <at>mode</at> is set to 0 (<m>Next</m>).
			</description>
			<attributelist>
				<attribute name="enumvals" get="1" set="1" type="atom" size="4">
					<enumlist>
						<enum name="Forward">
							<digest>
								Loop forwards
							</digest>
							<description>
								The current index is incremented by 1 and reset to 0 when it reaches the current buffer size.
							</description>
						</enum>
						<enum name="Reverse">
							<digest>
								Loop backwards
							</digest>
							<description>
								The current index is decremented by a1 nd reset to the buffer size - 1 after it reaches 0.
							</description>
						</enum>
						<enum name="Random">
							<digest>
								Choose index randomly with repetitions allowed
							</digest>
							<description>
								The index into the buffer will be chosen randomly, and the same index value can be chosen multiple times (similar to the Max <o>random</o> object).
							</description>
						</enum>
						<enum name="Urn">
							<digest>
								Choose index randomly without repetitions
							</digest>
							<description>
								The index into the buffer will be chosen randomly, but the same value cannot be chosen multiple times before all values are chosen (similar to the Max <o>urn</o> object).
							</description>
						</enum>
					</enumlist>
				</attribute>
				<attribute name="label" get="1" set="1" type="symbol" size="1" value="Advance Direction" />
				<attribute name="style" get="1" set="1" type="symbol" size="1" value="enumindex" />
			</attributelist>
		</attribute>
		<attribute name="duration" get="1" set="1" type="atom_long" size="1">
			<digest>
				Output Duration in Samples
			</digest>
			<description>
				When the <at>duration</at> attribute is a non-zero value, the output signal remains at its new value for that number of samples, then resets to 0. Set <at>duration</at> to 1 to generate impulses. When <at>duration</at> is 0, the output value is held constant.
			</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="extend" get="1" set="1" type="int" size="1">
			<digest>
				Index Outside Buffer Handling
			</digest>
			<description>
				The <at>extend</at> attribute controls how <o>stash~</o> responds when an input index value (either signal or float) is less than zero or greater than the buffer size.
			</description>
			<attributelist>
				<attribute name="enumvals" get="1" set="1" type="atom" size="4">
					<enumlist>
						<enum name="Zero">
							<digest>
								Output zero
							</digest>
							<description>
								When <at>extend</at> is Zero (0), a zero signal is output when the index is outside the buffer's bounds.
							</description>
						</enum>
						<enum name="Extend">
							<digest>
								Output lowest or highest values
							</digest>
							<description>
								When <at>extend</at> is set to Extend (1), <o>stash~</o> outputs the value at index 0 is output when the input index less than zero. It outputs the value at the highest buffer index is when the input index is greater than the buffer size.
							</description>
						</enum>
						<enum name="Wrap">
							<digest>
								Wrap index
							</digest>
							<description>
								When <at>extend</at> is set to Wrap (2), <o>stash~</o> performs a modulo operation on the input index. Example: if the buffer size is 128 and the input is 130, the value at index 2 (130 mod 128) will be output.
							</description>
						</enum>
						<enum name="Ignore">
							<digest>
								Don't change output
							</digest>
							<description>
								When <at>extend</at> is set to Ignore (3), any input index outside the buffer size is ignored and does not change the output.
							</description>
						</enum>
					</enumlist>
				</attribute>
				<attribute name="label" get="1" set="1" type="symbol" size="1" value="Index Outside Buffer Handling" />
				<attribute name="style" get="1" set="1" type="symbol" size="1" value="enumindex" />
			</attributelist>
		</attribute>
		<attribute name="interp" get="1" set="1" type="int" size="1">
			<digest>
				Interpolation Mode
			</digest>
			<description>
				Determines the interpretation of non-integer index values from signals or the <at>index</at> attribute.
			</description>
			<attributelist>
				<attribute name="enumvals" get="1" set="1" type="atom" size="3">
					<enumlist>
						<enum name="None">
							<digest>
								Truncate index value
							</digest>
							<description>
								The value is the integer part of the index
							</description>
						</enum>
						<enum name="Linear">
							<digest>
								Linear interpolation
							</digest>
							<description>
								The value is produced by interpolating between the integer part of the index and the value above it.
							</description>
						</enum>
						<enum name="Round">
							<digest>
								Rounding
							</digest>
							<description>
								The value is rounded to the nearest intger to produce the index
							</description>
						</enum>
					</enumlist>
				</attribute>
				<attribute name="label" get="1" set="1" type="symbol" size="1" value="Interpolation Mode" />
				<attribute name="style" get="1" set="1" type="symbol" size="1" value="enumindex" />
			</attributelist>
		</attribute>
		<attribute name="maxsize" get="1" set="1" type="int" size="1">
			<digest>
				Max Buffer Size
			</digest>
			<description>
				Sets the maximum buffer size. Note that <at>maxsize</at> can only be changed when the <o>stash~</o> object is created as a typed-in argument. The default buffer size is 1000.
			</description>
			<attributelist>
				<attribute name="label" get="1" set="1" type="symbol" size="1" value="Max Buffer Size" />
			</attributelist>
		</attribute>
		<attribute name="mode" get="1" set="1" type="int" size="1">
			<digest>
				Advance Mode
			</digest>
			<description>
				Sets how the signal connected to the third inlet determines the buffer index of the output value.
			</description>
			<attributelist>
				<attribute name="enumvals" get="1" set="1" type="atom" size="3">
					<enumlist>
						<enum name="Next">
							<digest>
								Advance to the next value
							</digest>
							<description>
								Changes in the signal (as defined by the <at>advancetriggermode</at> attribute) change the index according to the advance direction (<at>dir</at> attribute).
							</description>
						</enum>
						<enum name="Index">
							<digest>
								Output the value at the specified index
							</digest>
							<description>
								In Index mode, <o>stash</o> uses the signal value in the third inlet as a lookup table index -- with interpolation (if <at>interp</at> is set to 1 (<i>Linear</i>).
							</description>
						</enum>
						<enum name="Normalized Index">
							<digest>
								Output the value at a normalized index
							</digest>
							<description>
								In Normalized Index mode, <o>stash</o> uses the current <at>size</at> of the buffer to calculate the signal value (which must be between 0 and 1). For example, if the <at>size</at> is 2, values below 0.5 will output the value at index 0 and values 0.5 and larger will output the value at index 1.
							</description>
						</enum>
					</enumlist>
				</attribute>
				<attribute name="label" get="1" set="1" type="symbol" size="1" value="Advance Mode" />
				<attribute name="style" get="1" set="1" type="symbol" size="1" value="enumindex" />
			</attributelist>
		</attribute>
		<attribute name="samplelevel" get="1" set="1" type="float" size="1">
			<digest>
				Sampling Level
			</digest>
			<description>
				Sets the signal value that will trigger sampling the signal connected to the left input. The <at>samplelevel</at> value applies when the <at>sampletriggermode</at> attribute is set to Ascending, Descending, or Ascending or Descending).
			</description>
			<attributelist>
				<attribute name="label" get="1" set="1" type="symbol" size="1" value="Sampling Level" />
			</attributelist>
		</attribute>
		<attribute name="sampletriggermode" get="1" set="1" type="int" size="1">
			<digest>
				Sample Trigger Mode
			</digest>
			<description>
				Determines how a signal connected to the second inlet is interpreted for capturing the value of a signal connected to the left inlet. The <at>sampletriggermode</at> applies when the <at>writemode</at> is set to Next.
			</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>
								Detect value in an ascending ramp
							</digest>
							<description>
								The left signal input is captured when the previous sample of f the signal connected to the second inlet is less than or equal to the <at>samplelevel</at> and the current sample is greater than the <at>samplelevel</at>.
							</description>
						</enum>
						<enum name="Descending">
							<digest>
								Detect value in an descending ramp
							</digest>
							<description>
								The left signal input is captured when the previous sample of the signal connected to the second inlet is greater than or equal to the <at>samplelevel</at> and the current sample is less than the <at>samplelevel</at>.
							</description>
						</enum>
						<enum name="Ascending or Descending">
							<digest>
								Detect value in an asecending or descending ramp
							</digest>
							<description>
								The left signal input is captured if either the ascending or descending condition is true. This mode is useful for detecting ramps in phasors with either positive and negative frequencies.
							</description>
						</enum>
						<enum name="Equals">
							<digest>
								Detect exact value
							</digest>
							<description>
								The left signal input is captured if the signal connected to the second inlet is exactly equal to the current sample. This mode is not recommend for phasor ramps since it is unlikely the ramp will output a sample exactly equal to any particular value. The value of <at>samplelevel</at> does not apply in this mode.
							</description>
						</enum>
						<enum name="Zero-to-Nonzero">
							<digest>
								Detect zero to non-zero transition
							</digest>
							<description>
								The left signal input is captured if the previous sample of the signal connected to the second inlet is zero and the current sample is non-zero. The value of <at>samplelevel</at> does not apply in this mode.
							</description>
						</enum>
						<enum name="Nonzero-to-Zero">
							<digest>
								Detect non-zero to zero transition
							</digest>
							<description>
								The output advances if the previous sample of the signal connected to the second inlet is non-zero and the current sample is zero. The value of <at>samplelevel</at> does not apply in this mode.
							</description>
						</enum>
						<enum name="Phase">
							<digest>
							</digest>
							<description>
								Phase mode treats the value of <at>samplelevel</at> as a phase value using the same phase detection algorithm as the <o>what~</o> object. In Phase mode, <o>stash~</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="Sample Trigger Mode" />
				<attribute name="style" get="1" set="1" type="symbol" size="1" value="enumindex" />
			</attributelist>
		</attribute>
		<attribute name="size" get="1" set="1" type="int" size="1">
			<digest>
				Size
			</digest>
			<description>
				Sets the buffer size, which can range from 1 to the value of <at>maxsize</at>. Note: a <m>list</m> received in the left inlet sets the <at>size</at> to the size of the list.
			</description>
			<attributelist>
				<attribute name="label" get="1" set="1" type="symbol" size="1" value="Size" />
			</attributelist>
		</attribute>
		<attribute name="writemode" get="1" set="1" type="int" size="1">
			<digest>
				Write Mode
			</digest>
			<description>
				The <at>writemode</at> attribute controls how the signal connected to the left inlet is captured (sampled). There are two aspects to capturing a signal: when it happens, and where the sample goes once it is captured. Logically, if you want to continue capturing to the same index, you need another signal that changes, because the index signal is not changing so it cannot provide triggering information.
			</description>
			<attributelist>
				<attribute name="enumvals" get="1" set="1" type="atom" size="3">
					<enumlist>
						<enum name="Next">
							<digest>
								Advance to the next index using second inlet
							</digest>
							<description>
								When <at>writemode</at> is set to 0 (Next), the write index signal in the right inlet is ignored. Changes in the signal in the second inlet cause samples in the left inlet to be captured. The specific changes that cause a sample to be captured are set by the <at>sampletriggermode</at> attribute.
							</description>
						</enum>
						<enum name="Index">
							<digest>
								Set buffer index for signal capture
							</digest>
							<description>
								When <at>writemode</at> is set to 1 (Index), the index signal in the right inlet determines the location where the sample will be written. Changes in the sample trigger signal connected to the second inlet cause samples in the left inlet to be captured to that location.
							</description>
						</enum>
						<enum name="Normalized Index">
							<digest>
								Set normalized buffer index for signal capture
							</digest>
							<description>
								When <at>writemode</at> is set to 2 (Normalized Index), the index signal in the right inlet is expected to range from 0  to 1. This value is multiplied by the current buffer size to set the location where the sample will be written. Changes in the sample trigger signal connected to the second inlet cause samples in the left inlet to be captured to that location.
							</description>
						</enum>
					</enumlist>
				</attribute>
				<attribute name="label" get="1" set="1" type="symbol" size="1" value="Write Mode" />
				<attribute name="style" get="1" set="1" type="symbol" size="1" value="enumindex" />
			</attributelist>
		</attribute>
	</attributelist>
	<!--EXAMPLE-->
	<examplelist>
		<example caption="" img="" />
	</examplelist>
	<!--SEEALSO-->
	<seealsolist>
		<seealsolist>
			<seealso name="click~" />
			<seealso name="mc.chord~" />
			<seealso name="phasor~" />
			<seealso name="sah~" />
			<seealso name="sig~" />
			<seealso name="table~" />
		</seealsolist>
	</seealsolist>
</c74object>
