| 1 | |
| 2 | <refentry id="FLsavesnap"> |
| 3 | <indexterm id="IndexFLsavesnap"><primary>FLsavesnap</primary></indexterm> |
| 4 | <refentryinfo><title>FLTK:Other</title></refentryinfo> |
| 5 | <refmeta> |
| 6 | <refentrytitle>FLsavesnap</refentrytitle> |
| 7 | </refmeta> |
| 8 | |
| 9 | <refnamediv> |
| 10 | <refname>FLsavesnap</refname> |
| 11 | <refpurpose> |
| 12 | Saves all snapshots currently created into a file. |
| 13 | </refpurpose> |
| 14 | </refnamediv> |
| 15 | |
| 16 | <refsect1> |
| 17 | <title>Description</title> |
| 18 | <para> |
| 19 | Plugin opcode in widgets. This opcode is part of the plugin repository and has to be installed separately. These FLTK widgets do not work on the Mac. |
| 20 | The plugin repository can be found here: <ulink url="https://github.com/csound/plugins"><citetitle>https://github.com/csound/plugins</citetitle></ulink></para> |
| 21 | <para> |
| 22 | <emphasis>FLsavesnap</emphasis> saves all snapshots currently created (i.e. the entire memory bank) into a file. |
| 23 | </para> |
| 24 | </refsect1> |
| 25 | |
| 26 | <refsect1> |
| 27 | <title>Syntax</title> |
| 28 | <synopsis><command>FLsavesnap</command> "filename" [, igroup]</synopsis> |
| 29 | </refsect1> |
| 30 | |
| 31 | <refsect1> |
| 32 | <title>Initialization</title> |
| 33 | <para> |
| 34 | <emphasis><quote>filename</quote></emphasis> -- a double-quoted string corresponding to a file to store a bank of snapshots. |
| 35 | </para> |
| 36 | <para> |
| 37 | <emphasis>igroup</emphasis> -- (optional) an integer number referring to a snapshot-related group of widget. It allows to get/set, or to load/save the state of a subset of valuators. Default value is zero that refers to the first group. The group number is determined by the opcode <link linkend="FLsetSnapGroup"><citetitle>FLsetSnapGroup</citetitle></link>. |
| 38 | </para> |
| 39 | <note> |
| 40 | <para> |
| 41 | The <emphasis>igroup</emphasis> parameter has not been yet fully implemented in the current version of csound. Please do not rely on it yet. |
| 42 | </para> |
| 43 | </note> |
| 44 | </refsect1> |
| 45 | |
| 46 | <refsect1> |
| 47 | <title>Performance</title> |
| 48 | <para> |
| 49 | <emphasis>FLsavesnap</emphasis> saves all snapshots currently created (i.e. the entire memory bank) into a file whose name is <emphasis>filename</emphasis>. Since the file is a text file, snapshot values can also be edited manually by means of a text editor. The format of the data stored in the file is the following (at present time, this could be changed in next Csound version): |
| 50 | |
| 51 | <informalexample> |
| 52 | <programlisting> |
| 53 | ----------- 0 ----------- |
| 54 | FLvalue 0 0 1 0 "" |
| 55 | FLvalue 0 0 1 0 "" |
| 56 | FLvalue 0 0 1 0 "" |
| 57 | FLslider 331.946 80 5000 -1 "frequency of the first oscillator" |
| 58 | FLslider 385.923 80 5000 -1 "frequency of the second oscillator" |
| 59 | FLslider 80 80 5000 -1 "frequency of the third oscillator" |
| 60 | FLcount 0 0 10 0 "this index must point to the location number where snapshot is stored" |
| 61 | FLbutton 0 0 1 0 "Store snapshot to current index" |
| 62 | FLbutton 0 0 1 0 "Save snapshot bank to disk" |
| 63 | FLbutton 0 0 1 0 "Load snapshot bank from disk" |
| 64 | FLbox 0 0 1 0 "" |
| 65 | ----------- 1 ----------- |
| 66 | FLvalue 0 0 1 0 "" |
| 67 | FLvalue 0 0 1 0 "" |
| 68 | FLvalue 0 0 1 0 "" |
| 69 | FLslider 819.72 80 5000 -1 "frequency of the first oscillator" |
| 70 | FLslider 385.923 80 5000 -1 "frequency of the second oscillator" |
| 71 | FLslider 80 80 5000 -1 "frequency of the third oscillator" |
| 72 | FLcount 1 0 10 0 "this index must point to the location number where snapshot is stored" |
| 73 | FLbutton 0 0 1 0 "Store snapshot to current index" |
| 74 | FLbutton 0 0 1 0 "Save snapshot bank to disk" |
| 75 | FLbutton 0 0 1 0 "Load snapshot bank from disk" |
| 76 | FLbox 0 0 1 0 "" |
| 77 | ----------- 2 ----------- |
| 78 | ..... etc... |
| 79 | ----------- 3 ----------- |
| 80 | ..... etc... |
| 81 | --------------------------- |
| 82 | </programlisting> |
| 83 | </informalexample> |
| 84 | </para> |
| 85 | |
| 86 | <para> |
| 87 | As you can see, each snapshot contain several lines. Each snapshot is separated from previous and next snapshot by a line of this kind: |
| 88 | |
| 89 | <literallayout> |
| 90 | "----------- snapshot Num -----------" |
| 91 | </literallayout> |
| 92 | |
| 93 | Then there are several lines containing data. Each of these lines corresponds to a widget. |
| 94 | </para> |
| 95 | |
| 96 | <para> |
| 97 | The first field of each line is an unquoted string containing opcode name corresponding to that widget. Second field is a number that expresses current value of a snapshot. In current version, this is the only field that can be modified manually. The third and fourth fields shows minimum and maximum values allowed for that valuator. The fifth field is a special number that indicates if the valuator is linear (value 0), exponential (value -1), or is indexed by a table interpolating values (negative table numbers) or non-interpolating (positive table numbers). The last field is a quoted string with the label of the widget. Last line of the file is always |
| 98 | |
| 99 | <literallayout> |
| 100 | "---------------------------" |
| 101 | </literallayout>. |
| 102 | </para> |
| 103 | <para> |
| 104 | Note that <link linkend="FLvalue"><citetitle>FLvalue</citetitle></link> and<link linkend="FLbox"><citetitle>FLbox</citetitle></link> are not valuators and their values are fixed, so they cannot be modified. |
| 105 | </para> |
| 106 | <para> |
| 107 | For purposes of snapshot saving, widgets can be grouped, so that snapshots affect only a defined group of widgets. The opcode <link linkend="FLsetSnapGroup"><citetitle>FLsetSnapGroup</citetitle></link> is used to specify the group for all widgets declared after it, until the next <link linkend="FLsetSnapGroup"><citetitle>FLsetSnapGroup</citetitle></link> statement. |
| 108 | </para> |
| 109 | </refsect1> |
| 110 | |
| 111 | <refsect1> |
| 112 | <title>Examples</title> |
| 113 | <para> |
| 114 | Here is a simple example of the FLTK snapshot saving. It uses the file <ulink url="examples/FLsavesnap_simple.csd"><citetitle>FLsavesnap_simple.csd</citetitle></ulink>. |
| 115 | |
| 116 | <example> |
| 117 | <title>Example of FLTK snapshot saving.</title> |
| 118 | <para>See the sections <link linkend="UsingRealTime"><citetitle>Real-time Audio</citetitle></link> and <link linkend="CommandFlags"><citetitle>Command Line Flags</citetitle></link> for more information on using command line flags.</para> |
| 119 | <xi:include href="examples-xml/FLsavesnap_simple.csd.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/> |
| 120 | </example> |
| 121 | </para> |
| 122 | <para> |
| 123 | Here is another example of FLTK snapshot saving using snapshot groups. It uses the file <ulink url="examples/FLsavesnap.csd"><citetitle>FLsavesnap.csd</citetitle></ulink>. |
| 124 | |
| 125 | <example> |
| 126 | <title>Example of FLTK snapshot saving using snapshot groups.</title> |
| 127 | <para>See the sections <link linkend="UsingRealTime"><citetitle>Real-time Audio</citetitle></link> and <link linkend="CommandFlags"><citetitle>Command Line Flags</citetitle></link> for more information on using command line flags.</para> |
| 128 | <xi:include href="examples-xml/FLsavesnap.csd.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/> |
| 129 | </example> |
| 130 | </para> |
| 131 | </refsect1> |
| 132 | |
| 133 | <refsect1> |
| 134 | <title>See Also</title> |
| 135 | <para> |
| 136 | <link linkend="FLgetsnap"><citetitle>FLgetsnap</citetitle></link>, |
| 137 | <link linkend="FLloadsnap"><citetitle>FLloadsnap</citetitle></link>, |
| 138 | <link linkend="FLsetSnapGroup"><citetitle>FLsetSnapGroup</citetitle></link>, |
| 139 | <link linkend="FLrun"><citetitle>FLrun</citetitle></link>, |
| 140 | <link linkend="FLsetsnap"><citetitle>FLsetsnap</citetitle></link>, |
| 141 | <link linkend="FLupdate"><citetitle>FLupdate</citetitle></link> |
| 142 | </para> |
| 143 | </refsect1> |
| 144 | |
| 145 | <refsect1> |
| 146 | <title>Credits</title> |
| 147 | <para>Author: &namegabriel;</para> |
| 148 | <para>New in version 4.22</para> |
| 149 | </refsect1> |
| 150 | </refentry> |