<?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="sustain" module="max" category="Notes">
	<digest>
		Hold note-off messages for release
	</digest>
	<description>
		Holds any notes with velocities of 0 until instructed to release them. This provides for sustain pedal-like behavior when working with incoming MIDI notes.
	</description>
	<!--METADATA-->
	<metadatalist>
		<metadata name="author">
			Cycling '74
		</metadata>
		<metadata name="tag">
			Max
		</metadata>
		<metadata name="tag">
			Notes
		</metadata>
	</metadatalist>
	<!--INLETS-->
	<inletlist>
		<inlet id="0" type="INLET_TYPE">
			<digest>
				Pitch
			</digest>
			<description>
				TEXT_HERE
			</description>
		</inlet>
		<inlet id="1" type="INLET_TYPE">
			<digest>
				Velocity
			</digest>
			<description>
				TEXT_HERE
			</description>
		</inlet>
		<inlet id="2" type="INLET_TYPE">
			<digest>
				Sustain On = 1, Off = 0
			</digest>
			<description>
				TEXT_HERE
			</description>
		</inlet>
	</inletlist>
	<!--OUTLETS-->
	<outletlist>
		<outlet id="0" type="OUTLET_TYPE">
			<digest>
				Pitch
			</digest>
			<description>
				TEXT_HERE
			</description>
		</outlet>
		<outlet id="1" type="OUTLET_TYPE">
			<digest>
				Velocity
			</digest>
			<description>
				TEXT_HERE
			</description>
		</outlet>
	</outletlist>
	<!--ARGUMENTS-->
	<objarglist>
		<objarg id="0" name="OBJARG_NAME" type="OBJARG_TYPE" optional="0">
			<digest>
				TEXT_HERE
			</digest>
			<description>
				TEXT_HERE
			</description>
		</objarg>
	</objarglist>
	<!--MESSAGES-->
	<methodlist>
		<method name="int">
			<arglist>
				<arg name="input" optional="0" type="int" />
			</arglist>
			<digest>
				Function depends on inlet
			</digest>
			<description>
				In left inlet: The number is the pitch value of a pitch-velocity pair. If the velocity value currently held by <o>sustain</o> is not 0, then the pair is sent out immediately. If the velocity is <m>0</m>, the note-off is either sent out or held, depending on whether <o>sustain</o> is turned on.
				<br />
				In middle inlet: The number is stored as a velocity to be paired with pitch numbers received in the left inlet.
				<br />
				In right inlet: If the number is not 0, <o>sustain</o> is turned on, and all note-offs are held. If the number is <m>0</m>, <o>sustain</o> is turned off, and all note-offs are sent out immediately.
			</description>
		</method>
		<method name="float">
			<arglist>
				<arg name="input" optional="0" type="float" />
			</arglist>
			<digest>
				Function depends on inlet
			</digest>
			<description>
				Converted to <m>int</m>.
			</description>
		</method>
		<method name="list">
			<arglist>
				<arg name="note/velocity pair" optional="0" type="list" />
			</arglist>
			<digest>
				Manage note-velocity pair
			</digest>
			<description>
				In left inlet: A two-item list consisting of a note-velocity pair can be input.
			</description>
		</method>
		<method name="clear">
			<arglist />
			<digest>
				Eliminate all held notes.
			</digest>
			<description>
				Clears the <m>sustain</m> object's internal memory. No note-off messages are output.
			</description>
		</method>
		<method name="flush">
			<arglist />
			<digest>
				Output all held note-offs.
			</digest>
			<description>
			</description>
		</method>
	</methodlist>
	<!--ATTRIBUTES-->
	<attributelist>
		<attribute name="repeatmode" get="1" set="1" type="int" size="1">
			<digest>
				Repeat Mode
			</digest>
			<description>
				Sets the behavior mode for handling repeated note-on messages. There are three modes of behavior:
				<br />
				<br />
				repeatmode 0: (Historical way) Playing the same note multiple times will not retrigger the played note when the sustain pedal is pressed or after a <m>sustain 1</m> message is received. This is the default state of the object.
				<br />
				repeatmode 1: (Re-trigger) Playing the same note multiple times will send a note off message and retrigger the played note no matter what its sustain state is. The <o>sustain</o> object will also keep track of the notes to stop when the sustain pedal is released or a <m>sustain 0</m> message is received.
				<br />
				repeatmode 2: (Stop last) Playing the same note multiple times will cause the <o>sustain</o> object to keep a count of the number of times the note has been played, holding and sending the accumulated note off messages when the sustain pedal is released or a <m>sustain 0</m> message is received.
			</description>
			<attributelist>
				<attribute name="basic" get="1" set="1" type="int" size="1" value="1" />
				<attribute name="category" get="1" set="1" type="symbol" size="1" value="Behavior" />
				<attribute name="enumvals" get="1" set="1" type="atom" size="3">
					<enumlist>
						<enum name="Historical Way">
							<digest>
								TEXT_HERE
							</digest>
							<description>
								TEXT_HERE
							</description>
						</enum>
						<enum name="Re-Trigger">
							<digest>
								TEXT_HERE
							</digest>
							<description>
								TEXT_HERE
							</description>
						</enum>
						<enum name="Stop Last">
							<digest>
								TEXT_HERE
							</digest>
							<description>
								TEXT_HERE
							</description>
						</enum>
					</enumlist>
				</attribute>
				<attribute name="label" get="1" set="1" type="symbol" size="1" value="Repeat Mode" />
				<attribute name="style" get="1" set="1" type="symbol" size="1" value="enumindex" />
			</attributelist>
		</attribute>
		<attribute name="sustain" get="1" set="1" type="int" size="1">
			<digest>
				Sustain
			</digest>
			<description>
				Enables (1) or disables (0) sustain mode. Setting this attribute or sending the message <m>sustain 1</m> or <m>sustain 0</m> is equivalent to pressing or releasing the sustain pedal.
			</description>
			<attributelist>
				<attribute name="basic" get="1" set="1" type="int" size="1" value="1" />
				<attribute name="category" get="1" set="1" type="symbol" size="1" value="Behavior" />
				<attribute name="label" get="1" set="1" type="symbol" size="1" value="Sustain" />
				<attribute name="style" get="1" set="1" type="symbol" size="1" value="onoff" />
			</attributelist>
		</attribute>
	</attributelist>
	<!--EXAMPLE-->
	<examplelist>
		<example img="sustain.png" caption="Like the sustain pedal of a piano, sustain releases all held notes at one time" />
	</examplelist>
	<!--SEEALSO-->
	<seealsolist>
		<seealso name="flush" />
		<seealso name="makenote" />
		<seealso name="stripnote" />
	</seealsolist>
	<misc name="Output">
		<entry name="int">
			<description>
				Out left outlet: The pitch value of a pitch-velocity pair.
				<br />
				<br />
				Out right outlet: The velocity value of a pitch-velocity pair.
				<br />
				<br />
				Note-on pairs are always sent out immediately. If <o>sustain</o> is turned on, note-offs are held until it is turned off. Otherwise, note-offs are sent out immediately.
			</description>
		</entry>
	</misc>
</c74object>
