<?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="play~" module="msp" category="MSP Sampling">
	<digest>
		Position-based sample playback
	</digest>
	<description>
		Use the <o>play~</o> object as a playback interface for a <o>buffer~</o>. that plays back samples based on an offset within the buffer. It is typically used with the <o>line~</o> object, but can be used with any signal that generates a changing position value in milliseconds. The <o>groove~</o> object provides another option for sample playback.
	</description>
	<!--METADATA-->
	<metadatalist>
		<metadata name="author">
			Cycling '74
		</metadata>
		<metadata name="tag">
			MSP
		</metadata>
		<metadata name="tag">
			MSP Sampling
		</metadata>
	</metadatalist>
	<!--INLETS-->
	<inletlist>
		<inlet id="0" type="signal">
			<digest>
				Sample Time to Play in ms
			</digest>
			<description>
				TEXT_HERE
			</description>
		</inlet>
		<inlet id="1" type="signal">
			<digest>
			</digest>
			<description>
				TEXT_HERE
			</description>
		</inlet>
	</inletlist>
	<!--OUTLETS-->
	<outletlist>
		<outlet id="0" type="signal">
			<digest>
				(signal) Channel 1 Output
			</digest>
			<description>
				(signal) Channel 1 Output
			</description>
		</outlet>
		<outlet id="1" type="signal">
			<digest>
				bang When playback reaches destination or when playback is stopped with a <m>0</m> or <m>stop</m> message
			</digest>
			<description>
				bang When playback reaches destination or when playback is stopped with a <m>0</m> or <m>stop</m> message.
			</description>
		</outlet>
	</outletlist>
	<!--ARGUMENTS-->
	<objarglist>
		<objarg name="buffer-name" optional="0" type="symbol">
			<digest>
				Buffer object name
			</digest>
			<description>
				The first argument names the <o>buffer~</o> object whose sample memory is used by <o>play~</o> for playback.
			</description>
		</objarg>
		<objarg name="number-of-output-channels" optional="1" type="int">
			<digest>
				Number of output channels
			</digest>
			<description>
				Specifies the number of output channels: 1, 2, or 4. The default number of channels is one. If the <o>buffer~</o> being played has fewer channels than the number of <o>play~</o> output channels, the extra channels output a zero signal. If the <o>buffer~</o> has more channels, channels are mixed.
			</description>
		</objarg>
	</objarglist>
	<!--MESSAGES-->
	<methodlist>
		<method name="int">
			<arglist>
				<arg name="start/stop-playback" optional="0" type="int" />
			</arglist>
			<digest>
				Start/stop playback of the <o>buffer~</o> object
			</digest>
			<description>
				In left inlet: 1 (or non-zero value) begins playback of the currently set <o>buffer~</o> object, and 0 stops playback.
			</description>
		</method>
		<method name="(mouse)">
			<digest>
				Open a file buffer display window
			</digest>
			<description>
				Double-clicking on <o>buffer~</o> opens a display window where you can view the contents of the <o>buffer~</o>. object that the <o>play~</o> object references.
			</description>
		</method>
		<method name="pause">
			<arglist />
			<digest>
				Pause playback
			</digest>
			<description>
				In left inlet: Sending the message <m>pause</m> causes the playback to pause at its current playback position. Playback can be restarted with the <m>resume</m> message.
			</description>
		</method>
		<method name="set">
			<arglist>
				<arg name="buffer-name" optional="0" type="symbol" />
			</arglist>
			<digest>
				Set the name of the <o>buffer~</o> used for playback
			</digest>
			<description>
				The word <m>set</m>, followed by the name of a <o>buffer~</o> object, uses that <o>buffer~</o> for playback.
			</description>
		</method>
		<method name="start">
			<arglist>
				<arg name="start-time" optional="0" units="ms" type="list" />
				<arg name="end-time" optional="1" units="ms" type="list" />
				<arg name="duration" optional="1" units="ms" type="list" />
			</arglist>
			<digest>
				Start playback
			</digest>
			<description>
				In left inlet: The word <m>start</m>, followed by a start time in milliseconds, moves to the specified position in the current <o>buffer~</o> and begins playing. After the start time, an optional end time can be specified, which will set a point for playback to stop. A third optional value can be provided to set the playback duration from the start point to the end point. When used without arguments, start will begin at the beginning of the <o>buffer~</o> and play to the end (equivalent to using the integer value 1 to start playback). The start time may be greater than the end time, in order to play a segment of the buffer in reverse.
			</description>
		</method>
		<method name="stop">
			<arglist />
			<digest>
				Stop playback
			</digest>
			<description>
				In left inlet: The <m>stop</m> message causes the playback to stop at its current playback position. (This is equivalent to sending the integer value 0 to stop playback).
			</description>
		</method>
		<method name="resume">
			<arglist />
			<digest>
				Resume paused playback
			</digest>
			<description>
				In left inlet: If playback was paused, playback resumes from the paused point in the audio buffer.
			</description>
		</method>
		<method name="signal">
			<arglist />
			<digest>
				Specify the offset from which to play the <o>buffer~</o> 
			</digest>
			<description>
				In left inlet: The position (in milliseconds) into the sample memory of a <o>buffer~</o> object from which to play. If the signal is increasing over time, <o>play~</o> will play the sample forward. If it is decreasing, <o>play~</o> will play the sample backward. If it remains the same, <o>play~</o> outputs the same sample repeatedly, which is equivalent to a DC offset of the sample value.
				<br />
				<br />
				The direction and speed of playback of a <o>play~</o> object can be set using integer messages provided to the <o>play~</o> object at signal rate. Typically, this is done using a <o>line~</o> object.
				<br />
				<br />
				Integer messages come in pairs - an initial integer that specifies the position in the buffer (in milliseconds) at which to start, followed by a second pair of numbers that specify the ending position in the buffer and the time (in milliseconds) over which the playback will occur. These messages are often sent as messages separated by a comma. Here are some examples:
				<br />
				<br />
				<m>0, 2000 2000</m>- Starting at the beginning of the buffer, play 2 seconds of audio at normal speed
				<br />
				<m>500, 0 500</m>- Play the first half second of a buffer backwards at normal speed.
				<br />
				<m>0, 1000 500</m>- Play the first second of a buffer at double speed (i.e. transpose it up an octave)
			</description>
		</method>
	</methodlist>
	<!--ATTRIBUTES-->
	<attributelist>
		<attribute name="interptime" get="1" set="1" type="float" size="1">
			<digest>
				Set loop interpolation crossfade time.
			</digest>
			<description>
				Sets the crossfade time for loop interpolation. If the value given is greater than the total loop duration, the total loop duration is used. The default crossfade duration is 50 milliseconds.
			</description>
			<attributelist>
				<attribute name="label" get="1" set="1" type="symbol" size="1" value="Loop interpolation time" />
			</attributelist>
		</attribute>
		<attribute name="loop" get="1" set="1" type="int" size="1">
			<digest>
				Turn on looping
			</digest>
			<description>
				In loop mode, when playback reaches the end time (see <m>start</m> message) it continues again from the start time. Loop mode is off by default.
			</description>
			<attributelist>
				<attribute name="label" get="1" set="1" type="symbol" size="1" value="Turn on looping" />
				<attribute name="style" get="1" set="1" type="symbol" size="1" value="onoff" />
			</attributelist>
		</attribute>
		<attribute name="loopinterp" get="1" set="1" type="int" size="1">
			<digest>
				Enable loop interpolation
			</digest>
			<description>
				Enables interpolation around the start and end points for a loop. By default, loop interpolation is off.
			</description>
			<attributelist>
				<attribute name="label" get="1" set="1" type="symbol" size="1" value="Enable loop interpolation" />
				<attribute name="style" get="1" set="1" type="symbol" size="1" value="onoff" />
			</attributelist>
		</attribute>
	</attributelist>
	<!--EXAMPLE-->
	<examplelist>
		<example img="play~.png" caption="play~ is usually driven by a ramp signal from line~, but other signals create novel effects" />
	</examplelist>
	<!--SEEALSO-->
	<seealsolist>
		<seealso name="2d.wave~" />
		<seealso name="buffer~" />
		<seealso name="buffir~" />
		<seealso name="groove~" />
		<seealso name="record~" />
		<seealso name="wave~" />
		<seealso name="index~" />
		<seealso name="07_samplingchapter01" module="msp" type="tutorial" />
	</seealsolist>
	<misc name="Output">
		<entry name="signal">
			<description>
				Sample output read from a <o>buffer~</o>. If <o>play~</o> has two or four output channels, the left outlet's signal contains the left channel of the sample, and the other outlets' signals contain the samples from the additional channels.
			</description>
		</entry>
	</misc>
</c74object>
