<?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.zigzag~" module="msp" category="MSP Functions, Multichannel">
	<digest>
		Linked list function editor (multichannel)
	</digest>
	<description>
		Use <o>zigzag~</o> to generate multisegment linear ramps. This object is similar to line~, but retains information about the ramp after it has been output, and allows modification of the list values for the ramp.
	</description>
	<!--METADATA-->
	<metadatalist>
		<metadata name="author">
			Cycling '74
		</metadata>
		<metadata name="tag">
			MSP
		</metadata>
		<metadata name="tag">
			MSP Functions
		</metadata>
	</metadatalist>
	<!--INLETS-->
	<inletlist>
		<inlet id="0" type="INLET_TYPE">
			<digest>
				Destination Value
			</digest>
			<description>
				TEXT_HERE
			</description>
		</inlet>
		<inlet id="1" type="INLET_TYPE">
			<digest>
				Speed
			</digest>
			<description>
				TEXT_HERE
			</description>
		</inlet>
	</inletlist>
	<!--OUTLETS-->
	<outletlist>
		<outlet id="0" type="signal">
			<digest>
				(signal) Output Ramp
			</digest>
			<description>
				TEXT_HERE
			</description>
		</outlet>
		<outlet id="1" type="signal">
			<digest>
				(signal) Current Index
			</digest>
			<description>
				TEXT_HERE
			</description>
		</outlet>
		<outlet id="2" type="signal">
			<digest>
				Contents of Current List
			</digest>
			<description>
				TEXT_HERE
			</description>
		</outlet>
		<outlet id="3" type="signal">
			<digest>
				bang When Line Reaches Destination
			</digest>
			<description>
				TEXT_HERE
			</description>
		</outlet>
	</outletlist>
	<!--ARGUMENTS-->
	<objarglist>
		<objarg name="initial-value" optional="1" type="int or float">
			<digest>
				Initial target value
			</digest>
			<description>
				Sets an initial value (y) for the <o>zigzag~</o> object.
			</description>
		</objarg>
	</objarglist>
	<!--MESSAGES-->
	<methodlist>
		<method name="bang">
			<arglist />
			<digest>
				Function depends on mode setting
			</digest>
			<description>
				In left inlet: The <o>zigzag~</o> object responds to a <m>bang</m> message according to its mode of behavior, which is set using the <m>mode</m> message.
				<br />
				<br />
				If the <o>zigzag~</o> object is set to mode 0 or mode 1, a <m>bang</m> message will cause the <o>zigzag~</o> object to go to the start point (or end point if the direction is negative) and begin outputting values from there.
				<br />
				<br />
				If the <o>zigzag~</o> object is set to mode 2, a <m>bang</m> message will cause the <o>zigzag~</o> object to jump to the next index in the list (or the previous index, if the current direction is negative) and begin outputting values from there.
			</description>
		</method>
		<method name="int">
			<arglist>
				<arg name="output-rate-coefficient" optional="0" type="int" />
			</arglist>
			<digest>
				Function depends on inlet
			</digest>
			<description>
				In left inlet: Converted to float.
				<br />
				<br />
				In right inlet: Specifies the rate at which the value and time pairs will be output. A value of 1.0 traverses the list forward at normal speed. A playback rate of -1 traverses the list backwards (i.e. in reverse). A value of .5 traverses the linked list at half the normal speed (effectively doubling the delay time values).
				<br />
				<br />
				(In left inlet: Converted to float.)
			</description>
		</method>
		<method name="float">
			<arglist>
				<arg name="output-rate-coefficient" optional="0" type="number" />
			</arglist>
			<digest>
				Function depends on inlet
			</digest>
			<description>
				In left inlet: Each element in the <o>zigzag~</o> object's linked list is a pair that consists of a target value (y), followed by a second number that specifies a total amount of time in milliseconds (delta-x). In that amount of time, numbers are output regularly in a line from the current index value to the target value. The list <m>0 0 3.5 500 10 1000</m> describes a line which begins with a value of 0 at time 0, rises to a value of 3.5 a half second later, and rises again to a value of 10 in 1 second.
				<br />
				<br />
				In right inlet: Specifies the rate at which the value and time pairs will be output. A value of 1.0 traverses the list forward at normal speed. A playback rate of -1 traverses the list backwards (i.e. in reverse). A value of .5 traverses the linked list at half the normal speed (effectively doubling the delay time values).
			</description>
		</method>
		<method name="list">
			<arglist>
				<arg name="index and event-pair" optional="0" type="list" />
			</arglist>
			<digest>
				Defines and triggers a ramp
			</digest>
			<description>
				Sets and triggers a function as (value) (ramp-time) pairs to define points in a ramp. Sending a <m>list</m> message will immediately trigger the ramp.
			</description>
		</method>
		<method name="append">
			<arglist>
				<arg name="value" optional="0" type="number" />
				<arg name="transition-time" optional="0" type="number" />
			</arglist>
			<digest>
				Append new event pair(s)
			</digest>
			<description>
				The word append, followed by a list, will add new (value) (ramp-time) pairs to the end of the current list. Sending an <m>append</m> message will immediately trigger a ramp only made of the new points.
			</description>
		</method>
		<method name="bangdelta">
			<arglist>
				<arg name="transition-time" optional="0" type="number" />
			</arglist>
			<digest>
				Set the transition time when a bang is received
			</digest>
			<description>
				In left inlet: The word <m>bangdelta</m>, followed by a <m>float</m> or <m>int</m>, specifies the time over which the transition between values occurs when the <o>zigzag~</o> object receives a <m>bang</m>. The default is 0 (i.e., and immediate transition).
			</description>
		</method>
		<method name="bound">
			<arglist>
				<arg name="start-index" optional="0" type="int" />
				<arg name="end-index" optional="0" type="int" />
			</arglist>
			<digest>
				In left inlet: The word <m>bound</m>, followed by two numbers which specify start and end indices (where 0 is the first element), sets the start and end points of the <o>zigzag~</o> object's linked list
			</digest>
			<description>
				In left inlet: The word <m>bound</m>, followed by two numbers which specify start and end indices (where 0 is the first element), sets the start and end points of the <o>zigzag~</o> object's linked list.
			</description>
		</method>
		<method name="delete">
			<arglist>
				<arg name="index" optional="0" type="int/list" />
			</arglist>
			<digest>
				Delete an index/value pair
			</digest>
			<description>
				In left inlet: The word <m>delete</m>, followed by an <m>int</m> which specifies a position (where 0 is the first element), will delete the value and time pair associated with that index from the list. A <m>list</m> can follow the <m>delete</m> message if you want to remove multiple event pairs from the list. The message <m>delete 0</m> will remove the current first value and time pair from the list; the second value and time pair (i.e. the value and time pair at index 1) will now become the first values in the list.
			</description>
		</method>
		<method name="dump">
			<arglist />
			<digest>
				Output all currently stored value and time pairs
			</digest>
			<description>
				In left inlet: The word <m>dump</m> will cause a list consisting of all currently stored value and time pairs in the form
				<br />
				<br />
				<m>index value delta-x</m> 				<br />
				<br />
				to be sent out the <o>zigzag~</o> object's 3rd outlet.
			</description>
		</method>
		<method name="end">
			<arglist>
				<arg name="end-index" optional="0" type="int" />
			</arglist>
			<digest>
				Set the point where the <o>zigzag~</o> object ceases output when triggered by a <m>bang</m> 
			</digest>
			<description>
				In left inlet: The word <m>end</m>, followed by an <m>int</m> which specifies a position (where 0 is the first element), sets the point at which the <o>zigzag~</o> object ceases its output when triggered by a <m>bang</m>.
			</description>
		</method>
		<method name="insert">
			<arglist>
				<arg name="index and event-pair" optional="0" type="list" />
			</arglist>
			<digest>
				In left inlet: The word <m>insert</m>, followed by an <m>int</m> which specifies a position (where 0 is the first element)
			</digest>
			<description>
				In left inlet: The word <m>insert</m>, followed by an <m>int</m> which specifies a position (where 0 is the first element) and a list, will insert new event pair(s) before the index specified. The message <m>insert 0 5 500</m> will create a new first entry in the linked list (at the 0 index) with a value of 5 and a time of 500 milliseconds.
			</description>
		</method>
		<method name="jump">
			<arglist>
				<arg name="index and transition-time" optional="0" type="list" />
			</arglist>
			<digest>
				In left inlet: The word <m>jump</m>, followed by an <m>int</m> which specifies a position (where 0 is the first element), skips to that point in the linked list and begins outputting value and time pairs from that point
			</digest>
			<description>
				In left inlet: The word <m>jump</m>, followed by an <m>int</m> which specifies a position (where 0 is the first element), skips to that point in the linked list and begins outputting value and time pairs from that point. An optional int can be used to specify the time, in milliseconds, over which the transition to the next value will occur (the default value is <m>0</m>).
			</description>
		</method>
		<method name="jumpend">
			<arglist>
				<arg name="transition-time" optional="0" type="number" />
			</arglist>
			<digest>
				Jump forward to the last linked list value
			</digest>
			<description>
				In left inlet: The word <m>jumpend</m> causes the <o>zigzag~</o> object to immediately jump forward to the last value (y)on the linked list.
			</description>
		</method>
		<method name="jumpstart">
			<arglist>
				<arg name="transition-time" optional="0" type="number" />
			</arglist>
			<digest>
				Jump to the first linked list value and output the currently selected list or selected portion of the list
			</digest>
			<description>
				In left inlet: The word <m>jumpstart</m> causes the <o>zigzag~</o> object to immediately jump to the first value (y)on the linked list and then output the currently selected list or selected portion of the list.
			</description>
		</method>
		<method name="line">
			<arglist>
				<arg name="breakpoints" type="list" optional="0" />
			</arglist>
			<digest>
				Set breakpoints in line~ format
			</digest>
			<description>
				The word <m>line</m> followed by a list of breakpoints in line~ format (as output by the <o>function</o> object) defines a ramp for <o>zigzag~</o>. The list should consist of alternating value, time pairs.
			</description>
		</method>
		<method name="next">
			<arglist>
				<arg name="transition-time" optional="0" type="number" />
			</arglist>
			<digest>
				Skip to the next value and time pair in the linked list
			</digest>
			<description>
				In left inlet: The word <m>next</m> skips to the next value and time pair in the linked list. An optional <m>int</m> can be used to specify the time over which the transition to the next value will occur (the default value is <m>0</m>).
			</description>
		</method>
		<method name="prev">
			<arglist>
				<arg name="transition-time" optional="0" type="number" />
			</arglist>
			<digest>
				Skip to the previous value and time pair in the linked list
			</digest>
			<description>
				In left inlet: The word <m>prev</m> skips to the previous value and time pair in the linked list. An optional <m>int</m> can be used to specify the time over which the transition to the previous value will occur (the default value is <m>0</m>).
			</description>
		</method>
		<method name="print">
			<arglist />
			<digest>
				Print status and contents of the object in the Max Console
			</digest>
			<description>
				In left inlet: The word <m>print</m> causes the current status and contents of the <o>zigzag~</o> object to be printed out in the Max Console. The output consists of the current mode, loopmode, the start, end, and loop length of the current list, the pendulum state, and moving value of the object, followed by a listing of each index in the linked list, along with its y and delta-x values.
			</description>
		</method>
		<method name="ramptime">
			<arglist>
				<arg name="transition-time" optional="0" units="ms" type="number" />
			</arglist>
			<digest>
				Set the ramp time for output signal
			</digest>
			<description>
				In left inlet: The word <m>ramptime</m>, followed by a number, sets the ramp time, in milliseconds, at which the output signal will arrive at the target value.
			</description>
		</method>
		<method name="set">
			<arglist>
				<arg name="index" optional="0" type="int" />
				<arg name="value" optional="0" type="number" />
				<arg name="transition-time" optional="0" type="number" />
			</arglist>
			<digest>
				Set ramps without triggering them
			</digest>
			<description>
				Prepending the word <m>set</m> to user-defined value and <m>ramptime</m> messages allows for setting <o>zigzag~</o> ramps without triggering playback.
			</description>
		</method>
		<method name="setindex">
			<arglist>
				<arg name="index" optional="0" type="int" />
				<arg name="value" optional="0" type="number" />
				<arg name="transition-time" optional="0" type="number" />
			</arglist>
			<digest>
				Set the value and transition time for an index
			</digest>
			<description>
				In left inlet: The word <m>setindex</m>, followed by an <m>int</m> which specifies a position (where 0 is the first element) and a pair of floats, sets the target value (y) and transition time amounts (delta-x) for the specified position in the list.
			</description>
		</method>
		<method name="setline">
			<arglist>
				<arg name="breakpoints" type="list" optional="0" />
			</arglist>
			<digest>
				Set breakpoints in line~ format without triggering them
			</digest>
			<description>
				The word <m>setline</m> followed by a list of breakpoints in line~ format (as output by the <o>function</o> object) defines a ramp for <o>zigzag~</o> without triggering it. In order to trigger the ramp, a bang needs to be sent to the first inlet. The list should consist of alternating value, time pairs.
			</description>
		</method>
		<method name="signal">
			<arglist />
			<digest>
				Function depends on inlet
			</digest>
			<description>
				In left inlet: The <o>zigzag~</o> object responds to signal values according to its mode of behavior, which is set using the <m>mode</m> message.
				<br />
				If the <o>zigzag~</o> object is set to <m>mode 0</m>, the current index of the list is determined by the input signal value; any previously set <m>speed</m>, <m>loopmode</m>, <m>start</m>, and <m>end</m> messages will be ignored.
				<br />
				If a signal is connected to the left inlet of the <o>zigzag~</o> object in <m>mode 1</m>, the input signal functions as a trigger signal; when the slope of the input signal changes from non-negative to negative, the object will be re-triggered as though a <m>bang</m> were received.
				<br />
				If a signal is connected to the left inlet of the <o>zigzag~</o> object in <m>mode 2</m>, the input signal functions as a trigger signal; when the slope of the input signal changes from non-negative to negative, the object will be re-triggered as though a <m>bang</m> were received.
				<br />
				<br />
				In right inlet: A signal value specifies the rate at which the value and time pairs will be output. A value of 1.0 traverses the list forward at normal speed. A playback rate of -1 traverses the list backwards (i.e. in reverse). A signal value of .5 traverses the linked list at half the normal speed (effectively doubling the delay time values). The value of the input signal is sampled once per input vector. Therefore, any periodic frequency modulation with a period which is greater than the current sample rate/(2*vector_size) will alias.
			</description>
		</method>
		<method name="skip">
			<arglist>
				<arg name="number-of-skipped-indices and transition-time" optional="0" type="list" />
			</arglist>
			<digest>
				Skip indices in the <o>zigzag~</o> object's linked list
			</digest>
			<description>
				In left inlet: The word <m>skip</m>, followed by a positive or negative number, will skip the specified number of indices in the <o>zigzag~</o> object's linked list. Positive number values skip forward, and negative values skip backward. An optional integer can be used to specify the time over which the transition to the next or previous value will occur (the default value is <m>0</m>).
			</description>
		</method>
		<method name="speed">
			<arglist>
				<arg name="output-rate" optional="0" type="number" />
			</arglist>
			<digest>
				Set the output rate for value and time pairs
			</digest>
			<description>
				In left inlet: The word <m>speed</m>, followed by a positive or negative floating-point number, specifies the rate at which the value and time pairs will be output. The message <m>speed 1.0</m> traverses the list forward at normal speed, <m>speed -1</m> traverses the list backwards, <m>speed .5</m> traverses the linked list at half the normal speed (effectively doubling the delay time values).
			</description>
		</method>
		<method name="start">
			<arglist>
				<arg name="start-index" optional="0" type="number" />
			</arglist>
			<digest>
				Set the point where the <o>zigzag~</o> object starts output when triggered by a <m>bang</m> 
			</digest>
			<description>
				In left inlet: The word <m>start</m>, followed by an <m>int</m> which specifies a position (where 0 is the first element), sets the point at which the <o>zigzag~</o> object begins its output when triggered by a <m>bang</m>.
			</description>
		</method>
		<method name="stop">
			<arglist />
			<digest>
				Stops the ramp at the current position
			</digest>
			<description>
				Sending the <m>stop</m> message causes the ramp to stop at the current position.
			</description>
		</method>
	</methodlist>
	<!--ATTRIBUTES-->
	<attributelist>
		<attribute name="loopmode" get="1" set="1" type="int" size="1">
			<digest>
				Enable looping
			</digest>
			<description>
				The word <m>loopmode</m>, followed by 1, turns on looping. <m>loopmode 0</m> turns off looping. By default, looping is off. <m>loopmode 2</m> turns on looping in &quot;pendulum&quot; mode, in which the value and time pairs are traversed in an alternating forward and reverse direction. By default, looping is off
			</description>
			<attributelist>
				<attribute name="enumvals" get="1" set="1" type="atom" size="3">
					<enumlist>
						<enum name="No Loop">
							<digest>
								looping off
							</digest>
							<description>
								TEXT_HERE
							</description>
						</enum>
						<enum name="Forward">
							<digest>
								forward looping on
							</digest>
							<description>
								TEXT_HERE
							</description>
						</enum>
						<enum name="Palindrome">
							<digest>
								palindrome looping
							</digest>
							<description>
								TEXT_HERE
							</description>
						</enum>
					</enumlist>
				</attribute>
				<attribute name="style" get="1" set="1" type="symbol" size="1" value="enumindex" />
			</attributelist>
		</attribute>
		<attribute name="maxpoints" get="1" set="1" type="int" size="1">
			<digest>
				Maximum-line points
			</digest>
			<description>
				Specifies the number of user-defined points for ramps. The defualt value is 2048.
			</description>
		</attribute>
		<attribute name="mode" get="1" set="1" type="int" size="1">
			<digest>
				Specify how the <o>zigzag~</o> object responds to messages and signal values
			</digest>
			<description>
				<m>mode</m> specifies the way that the <o>zigzag~</o> object responds to messages and signal values.
				<br />
				mode 0 (default): When the <o>zigzag~</o> object receives a <m>bang</m>, it will jump to the start point (or end point if our direction is negative) and begin outputting values from there. The time value associated with this jump has its length defined by the <m>bangdelta</m> message. The default value for <m>bangdelta</m> is <m>0</m>. If a signal is connected to the left inlet of the <o>zigzag~</o> object in this mode, the current index of the list is determined by the signal; any previously set <m>speed</m>, <m>loopmode</m>, <m>start</m>, and <m>end</m> messages are ignored.
				<br />
				<br />
				mode 1: behavior is exactly the same as in mode 0 in terms of the effect of a <m>bang</m>. In mode 1, signal inputs are handled differently. If a signal is connected to the left inlet of the <o>zigzag~</o> object in mode 1, the input signal functions as a trigger signal; when the slope of the input signal changes from non-negative to negative, the object will be re-triggered as though a <m>bang</m> were received.
				<br />
				<br />
				mode 2: jump to the next index in the list (or the previous index, if the current direction is negative) and begin outputting values from there. The time value associated with this jump has its length defined by the <m>bangdelta</m> message. The default value for <m>bangdelta</m> is <m>0</m>. If a signal is connected to the left inlet of the <o>zigzag~</o> object in mode 2, the input signal functions as a trigger signal; when the slope of the input signal changes from non-negative to negative, the object will be re-triggered as though a <m>bang</m> were received.
			</description>
		</attribute>
	</attributelist>
	<!--EXAMPLE-->
	<examplelist>
		<example img="zigzag~.png" caption="zigzag~ can be used as a multi-purpose, editable ramp generator" />
	</examplelist>
	<!--SEEALSO-->
	<seealsolist>
		<seealso name="adsr~" />
		<seealso name="curve~" />
		<seealso name="kink~" />
		<seealso name="line~" />
	</seealsolist>
	<discussion>
		The <o>zigzag~</o> object uses a linked list implementation rather than the <o>line~</o> object's stack-based implementation, which does not retain information after it has been output. In addition to simply remembering the current &quot;line&quot;, the <o>zigzag~</o> object lets you modify the list by inserting, deleting, or appending points.
		<br />
		<br />
		Each element in the <o>zigzag~</o> object's linked list has a value (y), and a transition time value (delta-x), which specifies the amount of time over which the transition from one value to another will occur. When <o>zigzag~</o> contains a list, this list can be triggered (the starting and ending points can be set and changed), traversed forwards or backwards at different speeds, and looped. The current position in the list can be jumped to, and also held.
	</discussion>
	<misc name="Output">
		<entry name="signal">
			<description>
				Out 1st outlet: The current target value, or a ramp moving toward the target value according to the currently stored value and the target time.
				<br />
				<br />
				Out 2nd outlet: The current index.
			</description>
		</entry>
		<entry name="list">
			<description>
				Out 3rd outlet: In response to the dump message, a list consisting of all currently stored value and time pairs in the form
				<br />
				<br />
				<m>index value (y) delta-x</m> 				<br />
				<br />
				is output.
			</description>
		</entry>
		<entry name="bang">
			<description>
				Out right outlet: When looping, a <m>bang</m> message is sent out when the loop (re-trigger) point is reached. A <m>bang</m> is also sent out when <o>zigzag~</o> has finished generating all of its ramps.
			</description>
		</entry>
	</misc>
	<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>
