<?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="poly~" module="msp" category="MSP Polyphony">
	<digest>
		Manage polyphony/DSP for patchers
	</digest>
	<description>
		Use the <o>poly~</o> to encapsulate a patcher inside an object box, to specify the patcher filename and the number of instances you want to load as arguments to the <o>poly~</o> object, and to control object processing and routing in the loaded patcher instances.
	</description>
	<!--METADATA-->
	<metadatalist>
		<metadata name="author">
			Cycling '74
		</metadata>
		<metadata name="tag">
			MSP
		</metadata>
		<metadata name="tag">
			MSP Polyphony
		</metadata>
	</metadatalist>
	<!--INLETS-->
	<inletlist>
		<inlet id="0" type="signal, message">
			<digest>
				Input 1 of
			</digest>
			<description>
				TEXT_HERE
			</description>
		</inlet>
		<inlet id="1" type="signal, message">
			<digest>
				Input 2 of
			</digest>
			<description>
				TEXT_HERE
			</description>
		</inlet>
	</inletlist>
	<!--OUTLETS-->
	<!--ARGUMENTS-->
	<objarglist>
		<objarg name="patcher-name" optional="0" type="symbol">
			<arglist />
			<digest>
				Name of a patcher to be loaded
			</digest>
			<description>
				The first argument must specify the name of a patcher to be loaded which already exists and is in the Max search path. A subpatch window is not automatically opened for editing when a patcher argument is supplied for the <o>poly~</o> object.
			</description>
		</objarg>
		<objarg name="number-of-instances" optional="1" type="int">
			<arglist />
			<digest>
				Number of patcher instances to be loaded
			</digest>
			<description>
				The number of patcher instances corresponds to the number of available &quot;voices&quot; This number can be any number between 1 and 1023, and may be dynamically changed by using the <m>voices</m> message.
			</description>
		</objarg>
		<objarg name="local and flag (0 or 1)" optional="1" type="symbol">
			<digest>
				Enable local DSP scheduling
			</digest>
			<description>
				With <m>local</m> set to 1, the <o>poly~</o> object maintains its own scheduler that runs during its audio processing rather than using the global Max scheduler, allowing finer resolution for events generated by multiple patcher instances. The local scheduler is run immediately before processing a vector of audio, as if &quot;Scheduler in Audio Interrupt&quot; were on within the context of the poly~ object. Local scheduling is disabled by default - Scheduler locality is permanent for any patcher which is loaded, and cannot be changed by sending messages to the <o>poly~</o> object.
			</description>
		</objarg>
		<objarg name="'up' and up-sampling-factor" optional="1" type="symbol">
			<digest>
				Enable local upsampling
			</digest>
			<description>
				Use the <m>up</m> argument followed by a number which is a power of two to upsample local DSP processing on the currently loaded patcher (e.g., <m>up 2</m> specifies 88200 Hz at a sampling rate of 44100 Hz). Upsampling may be dynamically changed by using the <m>up</m> message.
			</description>
		</objarg>
		<objarg name="'down' and down-sampling factor" optional="1" type="symbol">
			<digest>
				Enable local downsampling
			</digest>
			<description>
				Use the <m>down</m> argument followed by a number which is a power of two to downsample local DSP processing on the currently loaded patcher (e.g., <m>down 2</m> specifies 22050 Hz at a sampling rate of 44100 Hz). Downsampling may be dynamically changed by using the <m>down</m> message.
			</description>
		</objarg>
		<objarg name="'args' and list-of-argument-values" optional="1" type="symbol">
			<digest>
				Initialize argument values
			</digest>
			<description>
				Use the argument <m>args</m> followed by an argument value to initialize any pound-sign arguments in the loaded patcher (e.g., <m>args #1</m>). If used, the <m>args</m> argument must be the last argument word used; everything which appears after the word <m>args</m> will be treated as an argument value.
			</description>
		</objarg>
	</objarglist>
	<!--MESSAGES-->
	<methodlist>
		<method name="bang">
			<arglist />
			<digest>
				Send a bang to the patcher loaded into the <o>poly</o> object.
			</digest>
			<description>
				Sends a bang to the patcher loaded into the <o>poly</o> object. The result of the message is determined by the loaded patcher.
			</description>
		</method>
		<method name="int">
			<arglist>
				<arg name="input" optional="0" type="int" />
			</arglist>
			<digest>
				Perform patcher-specific functions
			</digest>
			<description>
				Performs functions which are specific to the user-designed <o>poly~</o> patcher itself.
			</description>
		</method>
		<method name="float">
			<arglist>
				<arg name="input" optional="0" type="float" />
			</arglist>
			<digest>
				Perform patcher-specific functions
			</digest>
			<description>
				Performs functions which are specific to the user-designed <o>poly~</o> patcher itself.
			</description>
		</method>
		<method name="list">
			<arglist>
				<arg name="message" optional="0" type="list" />
			</arglist>
			<digest>
				Send a list to a poly instance
			</digest>
			<description>
				To send a message to a <o>poly~</o> instance that starts with one of the words used to control the <o>poly~</o> object itself, begin the message with the word <m>list</m>. For example, the message <m>list target 2</m> sent to the left inlet of <o>poly~</o> will output <m>target 2</m> out the outlet of all <link name="in" type="refpage">in 1</link> objects, rather than changing the current target instance to the second patcher.
			</description>
		</method>
		<method name="anything">
			<arglist>
				<arg name="message" optional="0" type="list" />
			</arglist>
			<digest>
				TEXT HERE
			</digest>
			<description>
				The number of inlets and outlets for <o>poly~</o> is determined by the patcher that is loaded. The inlets for the patcher loaded by a <o>poly~</o> object accept both signal and event connections.
				<br />
				<br />
				The signals are routed inside of the loaded patcher by using the <o>in~</o> objects for signals or the <o>in</o> object for events. The number of total inlets in a <o>poly~</o> object is determined by the highest number of an <o>in~</o> or <o>in</o> object in the loaded patcher (e.g., if there is an <o>in~</o> with argument 3 and an <o>in</o> with argument 4, the <o>poly~</o> object will have four inlets. All the inlets accept signal connections even though there may not be an <o>in~</o> object corresponding to each inlet.
				<br />
				<br />
				Signal inputs are fed to all instances.
			</description>
		</method>
		<method name="(drag)">
			<digest>
				Load a file when dragging a patch from the Max File Browser
			</digest>
			<description>
				Loads a file when dragging a patch from the Max File Browser to a <o>poly~</o> object.
			</description>
		</method>
		<method name="allnotesoff">
			<arglist />
			<digest>
				Disable all currently playing notes
			</digest>
			<description>
				Disables all playing notes by sending a message to each instance with a playing note consisting of the MIDI pitch most recently received via the <m>note</m> or <m>midinote</m> message followed by a zero velocity (note off message).
			</description>
		</method>
		<method name="busymap">
			<arglist>
				<arg name="message-outlet-number" optional="0" type="int" />
			</arglist>
			<digest>
				Report voice busy states
			</digest>
			<description>
				Reports the voice busy state for the number specified as the argument out the specified message outlet of the <o>poly~</o> object.
			</description>
		</method>
		<method name="(mouse)">
			<digest>
				Open a display window to view loaded patch contents
			</digest>
			<description>
				Double-clicking on the <o>poly~</o> opens a display window where you can view the contents of a loaded patcher.
			</description>
		</method>
		<method name="down">
			<arglist>
				<arg name="'down' and sampling-factor" optional="0" type="int" />
			</arglist>
			<digest>
				Downsample the audio on the currently loaded patcher
			</digest>
			<description>
				Use the <m>up</m> argument followed by a number which is a power of two to downsample local DSP processing on the currently loaded patcher (e.g., <m>down 2</m> specifies 22050 Hz at a sampling rate of 44100 Hz). Downsampling may be dynamically changed by using the <m>down</m> message. Although both <m>up</m> and <m>down</m> are permissible messages to the <o>poly~</o> object, the <m>down</m> message takes precedence over <m>up</m>.
			</description>
		</method>
		<method name="exclude">
			<arglist>
				<arg name="voice-number" optional="0" type="int" />
				<arg name="status" optional="0" type="int" />
			</arglist>
			<digest>
				Exclude a voice from note allocation
			</digest>
			<description>
				Sending the word <m>exclude</m>, followed by a voice number and a one, prevents a <o>poly~</o> instance from being sent messages via note allocation when the <o>poly~</o> receives a <m>note</m> or <m>midinote</m> message. By default, all voices are enabled for note allocation. The word <m>exclude</m>, followed by a voice number and a zero re-enables the instance to receive messages when the <o>poly~</o> receives a <m>note</m> or <m>midinote</m> message.
			</description>
		</method>
		<method name="midievent">
			<arglist>
				<arg name="MIDI-message (2 to 4 numbers)" optional="0" type="list" />
			</arglist>
			<digest>
				Send a MIDI event to a poly~ voice
			</digest>
			<description>
				The word <m>midievent</m>, followed by two to four numbers, sends a MIDI event to poly~. The first three number arguments are the bytes of the MIDI message. The fourth, optional, argument is a detune parameter used for MIDI note messages. <m>midievent</m> messages are intended to be used with the <o>polymidiin</o> object.
			</description>
		</method>
		<method name="mute">
			<arglist>
				<arg name="instance" optional="0" type="int" />
				<arg name="on/off-flag" optional="0" type="int" />
			</arglist>
			<digest>
				Mute processing for a patcher instance
			</digest>
			<description>
				Turns off signal processing for the specified instance of of a patcher loaded by the <o>poly~</o> object and sends a <m>bang</m> message to the <o>thispoly~</o> object for the specified instance. Sending a <m>0</m> as the second argument turns the patcher instance on. The message <m>mute 0 1</m> mutes all instances, and <m>mute 0 0</m> turns on signal processing for all instances of the patcher. If all are muted using a <m>mute 0 1</m> message, individual instances cannot be unmuted until all are unmuted with a <m>mute 0 0</m> message.
			</description>
		</method>
		<method name="open">
			<arglist>
				<arg name="instance-index" optional="0" type="int" />
			</arglist>
			<digest>
				Open a patcher instance for viewing
			</digest>
			<description>
				The word <m>open</m>, followed by a number, opens the specified instance of the patcher. You can view the activity of any instance of the patcher up to the number of voices (set by the <m>voices</m> message or by an argument to the <o>poly~</o> object). With no arguments, the <m>open</m> message opens the instance that is currently the target (see the <m>target</m> message).
			</description>
		</method>
		<method name="note">
			<arglist>
				<arg name="voice-allocated-data" optional="0" type="list" />
			</arglist>
			<digest>
				Send data to an available voice instance
			</digest>
			<description>
				The word <m>note</m>, followed by a message, will send the data to the first <o>in</o> object of the first instance of the patcher that has not marked itself &quot;busy&quot; by sending a <m>1</m> to a <o>thispoly~</o> object inside the patcher instance.
			</description>
		</method>
		<method name="midinote">
			<arglist>
				<arg name="voice" optional="0" type="int" />
				<arg name="note-values" optional="0" type="list" />
			</arglist>
			<digest>
				Send a MIDI note event or list of values to a <o>poly~</o> instance
			</digest>
			<description>
				The <m>midinote</m> message is followed by two or more values. While note values are ordinarily two numbers that specify a MIDI note number and a velocity value, any numbers may be used for patches which work differently than the standard MIDI model.
				<br />
				<br />
				If the second note value is not 0, the <o>poly~</o> object routes the pitch velocity to the first available instance. If the velocity is 0 (i.e. a MIDI note-off message), the pitch velocity will be sent to the <o>poly~</o> instance that generated the note. To determine which instance of the loaded patcher the <m>midinote</m> message will be sent to, send a <m>0</m> (non-busy) or <m>1</m> (busy) message to a <o>thispoly~</o> object located in the loaded patcher.
			</description>
		</method>
		<method name="mutemap">
			<arglist>
				<arg name="outlet-number" optional="0" type="int" />
			</arglist>
			<digest>
				Report voice mutes out of a specified <o>poly~</o> message outlet
			</digest>
			<description>
			</description>
		</method>
		<method name="notemessage">
			<arglist>
				<arg name="ARG_NAME_0" type="list" optional="0" />
			</arglist>
			<digest>
				Send an individual note control message
			</digest>
			<description>
				The <m>notemessage</m> message is used to send messages to each active voice (i.e. an individual instances of a subpatcher loaded by the <o>poly~</o> object). The message is sent directly to the <o>poly~</o> object by means of <o>in</o> objects (When addressing a <o>poly~</o> object, the first <o>in</o> object in the subpatcher is reserved for <m>midinote</m> messages). Sequentially, <m>notemessage</m> messages follow a <m>note</m> message -  the first argument of that message being taken as a pitch for the ID of subsequent <m>notemessage</m> messages. The <m>notemessage</m> messages can be of arbitrary length, and may be unpacked and routed inside the subpatcher. In situations where a note-off message that involves a time duration before its completion (e.g. by the use of an <o>adsr~</o> object), <m>notemessage</m> messages will be received for processing until the voice is turned off.
				<br />
				<br />
				Note: The only way to turn a voice off properly when using a <m>notemessage</m> is to use a signal to a <o>thispoly~</o> object in the subpatcher loaded by the <o>poly~</o> object (if a signal is <i>not</i> connected to the <o>thispoly~</o> object , the MIDI note-off message turns off the voice assignment immediately).
			</description>
		</method>
		<method name="mpeevent">
			<arglist>
				<arg name="ARG_NAME_0" type="list" optional="0" />
			</arglist>
			<digest>
				MPE Event Message
			</digest>
			<description>
				The MPE event message is a list composed of the symbol <m>mpeevent</m>, followed by 6 integers which specify the Zone First Channel, Zone Index, Voice Number, Channel Number, MIDI Message Number, and Data. This message can be sent to a patch encapsulated in a <o>poly~</o> object using the <o>polymidiin</o> object.
			</description>
		</method>
		<method name="up">
			<arglist>
				<arg name="'up' and sampling-factor" optional="0" type="int" />
			</arglist>
			<digest>
				Upsample the audio on the currently loaded patcher
			</digest>
			<description>
				Use the <m>up</m> argument followed by a number which is a power of two to upsample local DSP processing on the currently loaded patcher (e.g., <m>up 2</m> specifies 88200 Hz at a sampling rate of 44100 Hz). Upsampling may be dynamically changed by using the <m>up</m> message. Although both <m>up</m> and <m>down</m> are permissible messages to the <o>poly~</o> object, the <m>down</m> message takes precedence over <m>up</m>.
			</description>
		</method>
		<method name="threadcount">
			<arglist>
				<arg name="number of threads" optional="0" type="int" />
			</arglist>
			<digest>
				Set the number of threads used to divide <o>poly~</o> instances' audio processing
			</digest>
			<description>
				The word <m>threadcount</m>, followed by a number, sets the number of threads used to divide <o>poly~</o> instances' audio processing. The default is the number of processor cores available in your computer. Typically, the number of threads should be set to the number of processor cores in your computer for best performance. This can also be accomplished by sending the message <m>threadcount 0</m>. If a <o>poly~</o> object has sixteen instances and the threadcount is 4, four of the <o>poly~</o> instances will process audio in each of four threads.
			</description>
		</method>
		<method name="wclose">
			<arglist>
				<arg name="instance-index" optional="0" type="int" />
			</arglist>
			<digest>
				Close a numbered patcher instance's window
			</digest>
			<description>
				Closes the window for the numbered instance specified by the argument. If no number argument is used, <m>wclose</m> will close the patcher window with the highest numbered index.
			</description>
		</method>
	</methodlist>
	<!--ATTRIBUTES-->
	<attributelist>
		<attribute name="args" get="1" set="1" type="atom" size="10">
			<digest>
				Arguments for the Loaded Patch
			</digest>
			<description>
				When using messages to specifie arguments for a <o>poly~</o> object's loaded patch, the patch must be reloaded by setting the <m>patchername</m> attribute for new arguments to take effect after initial load.
			</description>
			<attributelist>
				<attribute name="label" get="1" set="1" type="symbol" size="1" value="Arguments" />
			</attributelist>
		</attribute>
		<attribute name="midimode" get="1" set="1" type="int" size="1">
			<digest>
				Send MIDI Events to All Voices
			</digest>
			<description>
				When midimode is set to '1', all MIDI messages sent to <o>poly~</o> will be sent to all voices. Note that this does not apply to <m>mpeevent</m> messages. In order to send all <m>mpeevent</m> messages to all voices, use a '-1' value for the voice argument, eg: 'mpeevent 1 1 2 210 117' (an aftertouch message to all voices).
			</description>
			<attributelist>
				<attribute name="default" get="1" set="1" type="int" size="1" value="0" />
				<attribute name="introduced" get="1" set="1" type="symbol" size="1" value="7.2.0" />
				<attribute name="label" get="1" set="1" type="symbol" size="1" value="Send MIDI Events to All Voices" />
				<attribute name="style" get="1" set="1" type="symbol" size="1" value="onoff" />
			</attributelist>
		</attribute>
		<attribute name="mpemode" get="1" set="1" type="int" size="1">
			<digest>
				Use MPE Channel as Voice
			</digest>
			<description>
				When this attribute is set to '1', poly~ will perform direct voice allocation based on the voice argument of an mpeevent message.
			</description>
			<attributelist>
				<attribute name="default" get="1" set="1" type="int" size="1" value="0" />
				<attribute name="introduced" get="1" set="1" type="symbol" size="1" value="7.2.0" />
				<attribute name="label" get="1" set="1" type="symbol" size="1" value="Use MPE Channel as Voice" />
				<attribute name="style" get="1" set="1" type="symbol" size="1" value="onoff" />
			</attributelist>
		</attribute>
		<attribute name="parallel" get="1" set="1" type="int" size="1">
			<digest>
				Parallel Processing Toggle
			</digest>
			<description>
				When this attribute is set to enable parallel processing, the <o>poly~</o> object enables the use of multiple threads to run audio processing for all patcher instances. If disabled <o>poly~</o> runs all patcher instances in the audio processing thread. The DSP chain must be restarted whenever the parallel attribute is changed. This attribute is disabled it when Max is hosted by the Live application.
				<br />
				<br />
				<b>Note:</b> At this time, you cannot specify a single subpatcher on a different core. When enabled, this attribute splits up the number of voices between the number of processors available. It is primarily intended for patches that use a significant amount of CPU within multiple voices of the same <o>poly~</o> object, and the multithreading overhead is primarily useful for larger signal vector sizes (at least 32 or greater). Other situations will not benefit. Using the default threadcount (which is equal to the number of physical cores) is best.
			</description>
			<attributelist>
				<attribute name="basic" get="1" set="1" type="int" size="1" value="1" />
				<attribute name="label" get="1" set="1" type="symbol" size="1" value="Parallel Processing" />
				<attribute name="style" get="1" set="1" type="symbol" size="1" value="onoff" />
			</attributelist>
		</attribute>
		<attribute name="patchername" get="1" set="1" type="symbol" size="1">
			<digest>
				Patcher File
			</digest>
			<description>
				The filename of a patcher file loaded into the <o>poly~</o> object.
			</description>
			<attributelist>
				<attribute name="basic" get="1" set="1" type="int" size="1" value="1" />
				<attribute name="label" get="1" set="1" type="symbol" size="1" value="Patcher File" />
				<attribute name="style" get="1" set="1" type="symbol" size="1" value="patcher" />
			</attributelist>
		</attribute>
		<attribute name="resampling" get="1" set="1" type="int" size="1">
			<digest>
				Use Resampling Filters
			</digest>
			<description>
				Toggles the use of high-quality resampling filters. These filters are enabled by default.
			</description>
			<attributelist>
				<attribute name="label" get="1" set="1" type="symbol" size="1" value="Use Resampling Filters" />
			</attributelist>
		</attribute>
		<attribute name="steal" get="1" set="1" type="int" size="1">
			<digest>
				Voice Stealing Enable
			</digest>
			<description>
				Voice stealing enable causes the <o>poly~</o> object sends the data from the <m>note</m> or <m>midinote</m> messages to instances that are still marked &quot;busy&quot;; this can result in clicks depending on how the instances handle the interruption. Voice stealing is disabled by default.
			</description>
			<attributelist>
				<attribute name="basic" get="1" set="1" type="int" size="1" value="1" />
				<attribute name="label" get="1" set="1" type="symbol" size="1" value="Voice Stealing" />
				<attribute name="style" get="1" set="1" type="symbol" size="1" value="onoff" />
			</attributelist>
		</attribute>
		<attribute name="target" get="1" set="1" type="int" size="1">
			<digest>
				Target Voice Number
			</digest>
			<description>
				The <o>poly~</o> instance that will receive subsequent messages (other than messages specifically used by the <o>poly~</o> object itself) arriving at the <o>poly~</o> object's inlets - for example, The message <m>target 2</m> routes messages to the second instance. If the <m>target</m> message specifies a value greater than the current number of instances (copies) of the loaded patcher, the message will be sent to the highest numbered instance (e.g., sending the message <m>target 2</m> to a <o>poly~</o> object containing only a single instance will send subsequent messages to the first instance). The message <m>target 0</m> sends input to <i>all</i> instances, and using any negative number value with the <m>target</m> message will disable input to all instances.
			</description>
			<attributelist>
				<attribute name="label" get="1" set="1" type="symbol" size="1" value="Target Voice Number" />
			</attributelist>
		</attribute>
		<attribute name="voices" get="1" set="1" type="int" size="1">
			<digest>
				Number of Voices
			</digest>
			<description>
			</description>
			<attributelist>
				<attribute name="basic" get="1" set="1" type="int" size="1" value="1" />
				<attribute name="label" get="1" set="1" type="symbol" size="1" value="Number of Voices" />
			</attributelist>
		</attribute>
		<attribute name="vs" get="1" set="1" type="int" size="1">
			<digest>
				Signal Vector Size for the Loaded Patch
			</digest>
			<description>
				Specifies the signal vector size for the <o>poly~</o> object's loaded patch. The signal vector size will be set on the next compilation of the DSP chain. The <m>vs</m> message does not force a recompilation of the DSP chain. <m>vs 0</m> specifies no fixed vector size. The default is the current signal vector size.
			</description>
			<attributelist>
				<attribute name="label" get="1" set="1" type="symbol" size="1" value="Fixed Vector Size" />
			</attributelist>
		</attribute>
		<attribute name="zone" get="1" set="1" type="int" size="1">
			<digest>
				MPE Zone Select
			</digest>
			<description>
				Use this attribute to set the MPE 'zone' that the poly~ will listen to. The default is '0' (ignore zones).
			</description>
			<attributelist>
				<attribute name="default" get="1" set="1" type="int" size="1" value="0" />
				<attribute name="introduced" get="1" set="1" type="symbol" size="1" value="7.2.0" />
				<attribute name="label" get="1" set="1" type="symbol" size="1" value="MPE Zone Select" />
			</attributelist>
		</attribute>
	</attributelist>
	<!--EXAMPLE-->
	<examplelist>
		<example img="poly~.png" caption="The poly~ object manages multiple instances of a subpatch" />
	</examplelist>
	<!--SEEALSO-->
	<seealsolist>
		<seealso name="in" />
		<seealso name="in~" />
		<seealso name="out" />
		<seealso name="out~" />
		<seealso name="patcher" />
		<seealso name="thispoly~" />
		<seealso module="msp" name="10_midichapter03" type="tutorial" />
		<seealso module="msp" name="11_polychapter01" type="tutorial" />
	</seealsolist>
	<discussion>
		The <o>poly~</o> object directs signals and events (messages) received in its inlets to <o>in</o> and <o>in~</o> objects inside patcher instances, and handles the output of signals or events from instances of the <o>poly~</o> object using the <o>out</o> and <o>out~</o> objects.
	</discussion>
	<misc name="Output">
		<entry name="anything">
			<description>
				The number of outlets of a <o>poly~</o> object is determined by the sum of the highest argument numbers of the <o>out</o> and <o>out~</o> objects in the loaded patcher. For instance, if there is an <link name="out" type="refpage">out 3</link> object and an <link name="out~" type="refpage">out~ 2</link> object, the <o>poly~</o> object will have five outlets. The signal outputs corresponding to the <o>out~</o> objects are leftmost in the <o>poly~</o> object, followed by the event outlets corresponding to the <o>out</o> objects.
				<br />
				<br />
				Signals sent to the inlet of <o>out~</o> objects in each patcher instance are mixed if there is more than one instance and appear at the corresponding outlets of the <o>poly~</o> object.
			</description>
		</entry>
	</misc>
</c74object>
