<?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="filein" module="max" category="Files">
	<digest>
		Read and access a file of binary data
	</digest>
	<description>
		<o>filein</o> reads a file of binary data and outputs the data at various points in the file given the appropriate input.
	</description>
	<!--METADATA-->
	<metadatalist>
		<metadata name="author">
			Cycling '74
		</metadata>
		<metadata name="tag">
			Max
		</metadata>
		<metadata name="tag">
			Files
		</metadata>
	</metadatalist>
	<!--INLETS-->
	<inletlist>
		<inlet id="0" type="INLET_TYPE">
			<digest>
				Read Byte from File
			</digest>
			<description>
				TEXT_HERE
			</description>
		</inlet>
		<inlet id="1" type="INLET_TYPE">
			<digest>
				Read Word from File
			</digest>
			<description>
				TEXT_HERE
			</description>
		</inlet>
		<inlet id="2" type="INLET_TYPE">
			<digest>
				Read Long from File
			</digest>
			<description>
				TEXT_HERE
			</description>
		</inlet>
	</inletlist>
	<!--OUTLETS-->
	<outletlist>
		<outlet id="0" type="OUTLET_TYPE">
			<digest>
				File Data Output
			</digest>
			<description>
				TEXT_HERE
			</description>
		</outlet>
		<outlet id="1" type="OUTLET_TYPE">
			<digest>
				bang On End of File
			</digest>
			<description>
				TEXT_HERE
			</description>
		</outlet>
		<outlet id="2" type="OUTLET_TYPE">
			<digest>
				bang When Read/Spool Finished
			</digest>
			<description>
				TEXT_HERE
			</description>
		</outlet>
	</outletlist>
	<!--ARGUMENTS-->
	<objarglist>
		<objarg name="filename" optional="1" type="symbol">
			<digest>
				A file path
			</digest>
			<description>
				Specifies a filename to be read into the <o>filein</o> object automatically when the patch is loaded.
			</description>
		</objarg>
		<objarg name="spool" optional="1" type="symbol">
			<digest>
				Disk access flag
			</digest>
			<description>
				A second argument of the word <m>spool</m> will cause the file to be accessed from disk rather than read into memory.
			</description>
		</objarg>
	</objarglist>
	<!--MESSAGES-->
	<methodlist>
		<method name="int">
			<arglist>
				<arg name="offset" optional="0" type="int" />
			</arglist>
			<digest>
				Set a file offset, output a byte
			</digest>
			<description>
				Specifies a byte offset in a binary file, and outputs the data stored at that point in the file.
			</description>
		</method>
		<method name="fclose">
			<arglist />
			<digest>
				Close a previously opened file
			</digest>
			<description>
				Closes the file being read, making <o>filein</o> no longer respond to <m>int</m> or <m>list</m> messages.
			</description>
		</method>
		<method name="in1">
			<arglist>
				<arg name="offset" optional="0" type="int" />
			</arglist>
			<digest>
				Set a file offset, output an integer
			</digest>
			<description>
				In middle inlet: The 16-bit word contained at that byte offset in the file is sent out the left outlet as an unsigned (short) integer.
			</description>
		</method>
		<method name="in2">
			<arglist>
				<arg name="byte-offset" optional="0" type="int" />
			</arglist>
			<digest>
				Set a file offset, output an integer
			</digest>
			<description>
				In right inlet: The 32-bit word contained at that byte offset within the file is sent out the left outlet as an unsigned (long) integer.
			</description>
		</method>
		<method name="spool">
			<arglist>
				<arg name="filename" optional="1" type="symbol" />
			</arglist>
			<digest>
				Open a file for disk access
			</digest>
			<description>
				Displays a standard file dialog to select a file, which will be accessed from disk whenever an <m>int</m> is received. If the word <m>spool</m> is followed by a filename found in Max's search path, that file will be automatically pointed to for future access. This method of accessing a file occupies less RAM, but does not output data immediately at interrupt level in response to an <m>int</m> message.
			</description>
		</method>
		<method name="read">
			<arglist>
				<arg name="filename" optional="1" type="symbol" />
			</arglist>
			<digest>
				Read a file into memory
			</digest>
			<description>
				Displays a standard file dialog to select a file to be read into memory. If the word <m>read</m> is followed by a filename found in Max's search path, that file will be automatically read into memory.
			</description>
		</method>
	</methodlist>
	<!--ATTRIBUTES-->
	<!--EXAMPLE-->
	<examplelist>
		<example img="filein.png" caption="Output the content of a file in 8-, 16-, or 32-bit chunks" />
	</examplelist>
	<!--SEEALSO-->
	<seealsolist>
		<seealso name="text" />
	</seealsolist>
	<misc name="Output">
		<entry name="int">
			<description>
				Out left outlet: An unsigned integer representing the 8, 16, or 32 bits stored in the file at the location specified by the input <m>int</m>.
			</description>
		</entry>
		<entry name="bang">
			<description>
				Out middle outlet: When a number greater than or equal to the number of bytes in the file is received in an inlet, a <m>bang</m> is sent out signifying that the end of the file (EOF) has been reached.
				<br />
				<br />
				Out right outlet: Signifies that a <m>read</m> or <m>spool</m> operation has been completed. This <m>bang</m> indicates that the file has been accessed successfully and that <o>filein</o> is ready to receive <m>int</m> messages.
			</description>
		</entry>
	</misc>
</c74object>
