| 1 | <refentry id="directory"> |
| 2 | <indexterm id="Indexdirectory"><primary>directory</primary></indexterm> |
| 3 | <refentryinfo><title>Miscellaneous</title></refentryinfo> |
| 4 | <refmeta> |
| 5 | <refentrytitle>directory</refentrytitle> |
| 6 | </refmeta> |
| 7 | |
| 8 | <refnamediv> |
| 9 | <refname>directory</refname> |
| 10 | <refpurpose> |
| 11 | Reads a directory and outputs to a string array a list of file names. |
| 12 | </refpurpose> |
| 13 | </refnamediv> |
| 14 | |
| 15 | <refsect1> |
| 16 | <title>Description</title> |
| 17 | <para> |
| 18 | Reads a directory for files and passes them to a string array. Users can set the file type by passing a file extension as a string. |
| 19 | </para> |
| 20 | </refsect1> |
| 21 | |
| 22 | <refsect1> |
| 23 | <title>Syntax</title> |
| 24 | <synopsis>SFiles[] <command>directory</command> SDirectory[, SExtention]</synopsis> |
| 25 | </refsect1> |
| 26 | |
| 27 | <refsect1> |
| 28 | <title>Initialization</title> |
| 29 | <para> |
| 30 | <emphasis>SDirectory</emphasis> -- a string that identifies the directory to browse for files |
| 31 | </para> |
| 32 | <para> |
| 33 | <emphasis>SExtention</emphasis> -- Optional. Sets the desired file type. If left out, all files names will be retrieved. |
| 34 | </para> |
| 35 | </refsect1> |
| 36 | |
| 37 | <refsect1> |
| 38 | <title>Performance</title> |
| 39 | <para> |
| 40 | <emphasis>SFiles[]</emphasis> -- a string array that holds the names of all files of a given type found in the directory. |
| 41 | </para> |
| 42 | </refsect1> |
| 43 | |
| 44 | <note> |
| 45 | <title>Note</title> |
| 46 | <para> |
| 47 | This works at i-time only and will not pick up changes made to the directory after performance has started. |
| 48 | </para> |
| 49 | </note> |
| 50 | |
| 51 | <refsect1> |
| 52 | <title>Example</title> |
| 53 | <para> |
| 54 | This example shows how directory can be used to browse for .wav files in a fixed location. <emphasis>printf_i</emphasis> is then used to print the file names. It uses the file <ulink url="examples/directory.csd"><citetitle>directory.csd</citetitle></ulink>. |
| 55 | <example> |
| 56 | <title>Example of the directory opcode.</title> |
| 57 | <xi:include href="examples-xml/directory.csd.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/> |
| 58 | </example> |
| 59 | </para> |
| 60 | </refsect1> |
| 61 | |
| 62 | <refsect1> |
| 63 | <title>See also</title> |
| 64 | <para><link linkend="MiscopcodesTop"><citetitle>Miscellaneous opcodes</citetitle></link></para> |
| 65 | </refsect1> |
| 66 | |
| 67 | <refsect1> |
| 68 | <title>Credits</title> |
| 69 | <para> |
| 70 | <simplelist> |
| 71 | <member>Author: Rory Walsh</member> |
| 72 | <member>2016</member> |
| 73 | </simplelist> |
| 74 | </para> |
| 75 | </refsect1> |
| 76 | </refentry> |