<?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="setclock" module="max" category="Timing">
	<digest>
		Create and control an alternative clock
	</digest>
	<description>
		Allows the creation of alternatives to the standard millisecond clock. This includes several modes of timing that change timing activities. Each <o>setclock</o> is associated with a name (its first argument), and this name may be passed as the argument to a &quot;clock&quot; message to numerous objects that use timing in Max, such as <o>metro</o>, <o>line</o>, and <o>pipe</o>.
	</description>
	<!--METADATA-->
	<metadatalist>
		<metadata name="author">
			Cycling '74
		</metadata>
		<metadata name="tag">
			Max
		</metadata>
	</metadatalist>
	<!--INLETS-->
	<inletlist>
		<inlet id="0" type="INLET_TYPE">
			<digest>
				Time Values or Adjustments
			</digest>
			<description>
				TEXT_HERE
			</description>
		</inlet>
		<inlet id="1" type="INLET_TYPE">
			<digest>
				Time Update Interval
			</digest>
			<description>
				TEXT_HERE
			</description>
		</inlet>
	</inletlist>
	<!--OUTLETS-->
	<outletlist>
		<outlet id="0" type="OUTLET_TYPE">
			<digest>
				Current Time of Clock (bang Message)
			</digest>
			<description>
				TEXT_HERE
			</description>
		</outlet>
	</outletlist>
	<!--ARGUMENTS-->
	<objarglist>
		<objarg name="name" optional="0" type="symbol">
			<digest>
				Global clock name
			</digest>
			<description>
				Obligatory. The first argument is the name of the <o>setclock</o> object, by which timing objects such as <o>clocker</o>, <o>line</o>, <o>metro</o>, <o>pipe</o>, and <o>tempo</o> can refer to the <o>setclock</o>. Those timing objects -- once they have received the message <m>clock</m> followed by the name of a <o>setclock</o> object -- use that <o>setclock</o> as their timing source instead of Max's regular millisecond clock. The <o>setclock</o> object need not be in the same patcher as the timing objects that refer to it. More than one <o>setclock</o> object may exist with the same name; <o>setclock</o> objects with the same name share the same clock time information. (Note: Different <o>setclock</o> objects that share the same name argument can have different mode arguments typed in, but they will in fact operate with the mode of whichever <o>setclock</o> was first loaded with that name. Thus, <o>setclock</o> objects with the same name but different modes may behave unpredictably, since the order in which they are loaded by Max is often unknown.)
				<br />
				<br />
				The second (optional) argument describes the mode of clock operation this <o>setclock</o> object will have. The possible modes for the second argument are:
			</description>
		</objarg>
		<objarg name="mode" optional="0" type="symbol">
			<digest>
				Clock timing mode
			</digest>
			<description>
				The word <m>pass</m> specifies passive mode. In this mode, the <o>setclock</o> object's current clock time is set by a number received in the left inlet, and associated timing objects will follow that clock time just as if it were a regularly progressing millisecond clock. If no second argument is present, the mode is <m>pass</m> by default.
				<br />
				<br />
				The word <m>add</m> specifies additive mode. A number received in the left inlet is added to the current clock time to determine the new clock time.
				<br />
				<br />
				The word <m>mul</m> specifies multiplicative mode. The number received in the left inlet is used as a factor by which all associated timing objects will modify their time settings. For example, a factor of <m>2.0</m> will cause all timing objects that are using the <o>setclock</o> as their clock source to double their time values (that is, to halve their speed). An alternative (and perhaps more truthful) way to conceptualize the behavior of <m>mul</m> mode is to think of the incoming float as a divisor by which <o>setclock</o> divides the speed at which its own clock time progresses. Thus, when it receives the number <m>2.0</m> it divides its own clock speed by 2.0, causing the objects which are following that clock to progress twice as slowly.
				<br />
				<br />
				The word <m>interp</m> specifies interpolate mode. The number received in the left inlet is gradually added to the current time of <o>setclock</o>, over a time period determined by the amount of time elapsed since the previous number was received. During that time period, <o>setclock</o> linearly interpolates to set its clock to the intermediate values.
			</description>
		</objarg>
		<objarg name="multiplier" optional="0" type="float">
			<digest>
				Multiplier for mul mode
			</digest>
			<description>
				If the second argument is <m>mul</m>, an optional third argument specifies a multiplier for the time of all associated timing objects. If no third argument is present, the multiplier is <m>1.0</m> by default.
			</description>
		</objarg>
	</objarglist>
	<!--MESSAGES-->
	<methodlist>
		<method name="bang">
			<arglist />
			<digest>
				Output current time
			</digest>
			<description>
				In left inlet: Sends out the current time value, according to the <o>setclock</o> object's own clock. Timing objects such as <o>clocker</o>, <o>line</o>, <o>metro</o>, <o>pipe</o>, and <o>tempo</o> can use <o>setclock</o> as their clock source instead of Max's regular millisecond clock.
			</description>
		</method>
		<method name="int">
			<arglist>
				<arg name="timing" optional="0" type="int" />
			</arglist>
			<digest>
				Function depends on mode
			</digest>
			<description>
				In left inlet: The meaning of the number depends on the second typed-in argument, which identifies the <o>setclock</o> object's mode of operation. If the mode is <m>pass</m>[ive] (the default mode), the number sets an absolute clock time which timing objects may use by comparing it to their initial time value. If the mode is <m>add</m>[itive], the number is added to the <o>setclock</o> object's current clock time. If the mode is <m>interp</m>[olate], <o>setclock</o> will change its clock time incrementally by that amount, over a time period determined by the time elapsed since the previous number was received. (However, negative numbers cause an immediate decrease in the clock time.) If the mode is <m>ext</m>[ernal], the number is simply ignored. If the mode is <m>mul</m>[tiplicative], the number is used as a multiplier for associated timing objects. For instance the number 0.5 halves the rate of increase (speed) of the associated timing objects.
				<br />
				<br />
				In right inlet: Sets the time interval, in milliseconds, at which the <o>setclock</o> will report its clock information to associated timing objects. The default is <m>5</m> milliseconds.
			</description>
		</method>
		<method name="float">
			<arglist>
				<arg name="timing" optional="0" type="float" />
			</arglist>
			<digest>
				Function depends on mode
			</digest>
			<description>
				Performs the same function as <m>int</m>.
			</description>
		</method>
		<method name="clock">
			<arglist>
				<arg name="clock name" optional="0" type="symbol" />
			</arglist>
			<digest>
				Set the clock name
			</digest>
			<description>
				The word clock, followed by a word, specifies the name of the name of the <o>setclock</o> object, by which timing objects such as <o>clocker</o>, <o>line</o>, <o>metro</o>, <o>pipe</o>, and <o>tempo</o> can refer to the <o>setclock</o>.
			</description>
		</method>
		<method name="(mouse)">
			<digest>
				Double-click prints status
			</digest>
			<description>
				Double-clicking with the mouse will print status messages in the Max Console.
			</description>
		</method>
		<method name="ft1">
			<arglist>
				<arg name="interval" optional="0" type="int" />
			</arglist>
			<digest>
				Set update interval
			</digest>
			<description>
				In right inlet: Sets the time update interval.
			</description>
		</method>
		<method name="set">
			<arglist>
				<arg name="interval" optional="0" type="float" />
			</arglist>
			<digest>
				Set timing interval for reporting
			</digest>
			<description>
				The word <m>set</m> followed by a number of milliseconds sets the timing interval at which the object will report its clock information to associated timing objects. The information is reported to those associated objects immediately.
			</description>
		</method>
		<method name="reset">
			<arglist>
				<arg name="interval" optional="0" type="float" />
			</arglist>
			<digest>
				Reset the timing interval
			</digest>
			<description>
				The word <m>reset</m> followed by a number of milliseconds sets the timing interval at which the object will report its clock information to associated timing objects. The information is reported whenever the next report is due according to the set interval.
			</description>
		</method>
	</methodlist>
	<!--ATTRIBUTES-->
	<!--EXAMPLE-->
	<examplelist>
		<example img="setclock.png" caption="setclock becomes the clock for metro... setclock modifies the time for clocker" />
	</examplelist>
	<!--SEEALSO-->
	<seealsolist>
		<seealso name="clocker" />
		<seealso name="metro" />
		<seealso name="timer" />
	</seealsolist>
	<misc name="Output">
		<entry name="int">
			<description>
				When <m>bang</m> is received in the left inlet, <o>setclock</o> sends its current time reading out the outlet.
			</description>
		</entry>
	</misc>
</c74object>
