<?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="midiflush" module="max" category="MIDI">
	<digest>
		Send MIDI note-offs for hanging note-ons
	</digest>
	<description>
		Analyzes a raw MIDI stream (from <o>midiin</o> or <o>seq</o>), counting the number of note-ons received for each note and MIDI channel. When it is sent a <m>bang</m>, MIDI note-off messages are sent for any notes which have not been turned off.
	</description>
	<!--METADATA-->
	<metadatalist>
		<metadata name="author">
			Cycling '74
		</metadata>
		<metadata name="tag">
			Max
		</metadata>
		<metadata name="tag">
			MIDI
		</metadata>
		<metadata name="reference">
			TEXT_HERE
		</metadata>
		<metadata name="license">
			TEXT_HERE
		</metadata>
	</metadatalist>
	<!--INLETS-->
	<inletlist>
		<inlet id="0" type="INLET_TYPE">
			<digest>
				Raw MIDI Data, bang flushes held notes
			</digest>
			<description>
				TEXT_HERE
			</description>
		</inlet>
		<inlet id="1" type="INLET_TYPE">
			<digest>
				Raw MIDI Data, bang flushes held notes
			</digest>
			<description>
				TEXT_HERE
			</description>
		</inlet>
	</inletlist>
	<!--OUTLETS-->
	<outletlist>
		<outlet id="0" type="OUTLET_TYPE">
			<digest>
				Raw MIDI Data
			</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="bang">
			<arglist />
			<digest>
				Send necessary note-off messages
			</digest>
			<description>
				When <o>midiflush</o> receives a <m>bang</m>, it outputs MIDI note-off messages for all note-ons which have not been matched by note-offs since the object was created (or the last <m>bang</m> message was sent).
			</description>
		</method>
		<method name="int">
			<arglist>
				<arg name="input" optional="0" type="int" />
			</arglist>
			<digest>
				Evaluate and pass through
			</digest>
			<description>
				Raw MIDI data from a source such as <o>seq</o> or <o>midiin</o> will be passed through unchanged, while the object observes which note-on messages on each channel have not received matching note-off messages.
			</description>
		</method>
		<method name="clear">
			<arglist />
			<digest>
				Clear stored note-ons
			</digest>
			<description>
				Erases any note-ons held by <o>midiflush</o>, without sending any note-offs.
			</description>
		</method>
	</methodlist>
	<!--ATTRIBUTES-->
	<!--EXAMPLE-->
	<examplelist>
		<example img="midiflush.png" caption="When midiflush receives a bang, it supplies note-offs for any held note-ons" />
	</examplelist>
	<!--SEEALSO-->
	<seealsolist>
		<seealso name="flush" />
		<seealso name="midiin" />
		<seealso name="midiinfo" />
		<seealso name="midiout" />
		<seealso name="midichapter02" module="max" type="tutorial" />
		<seealso name="midichapter04" module="max" type="tutorial" />
	</seealsolist>
	<discussion>
		This object is useful in conjunction with <o>seq</o>, which doesn't turn its notes off when it receives the <m>stop</m> message. At all times, <o>midiflush</o> echoes its input to output.
	</discussion>
	<misc name="Output">
		<entry name="int">
			<description>
				<o>midiflush</o> passes all its input through to its output, and sends MIDI note-off messages (as a series of numbers) for all note-ons which have not been matched by note-offs at its input.
			</description>
		</entry>
	</misc>
</c74object>
