DataFRead and DataFWrite


DataFRead and DataFWrite are used to store the content of a data object on file, and later
read back the content to the same dataobject, or to another dataobject of the same class.

In this example we show how the files can be managed by the operator from a fileview. The
operator has made som setting that is stored in a dataobject, and he can store different
setting with different filenames, this is done from a fileview in save mode. When he want to
restore a setting, he openes a fileview in open mode, and can selected a file from a list of
files he has previously stored.


Piano graph

In this simple Proview synthesizer the user can affect the sound with the sliders to the
right in the Piano graph. When he is satisfied, and want to store the settings, he presses
the "Store Sound" button. This is a CommandButton with the command


  open fileview /type=save /file="$pwrp_load/sound/*"
                /target=Piano-Plc-W-DataFWrite2.FileName
                /trigg=Piano-Plc-W-DataFWrite2.Condition


When the button is pressed the Xtt fileview is opened in save mode. It will list the files
"$pwrp_load/sound/*" in the file list.


Fileview to store data

When a filename is entered, the filename is stored in the DataFWrite object specififed in the
target switch, and Condition attribute in the same object is set with the /trigg switch. This
will trigger the DataFWrite object to perform a write of the TemplateSound object, connected to
it by a GetData.


Plc code

To restore a setting the "Load Sound" button is pressed. This is a CommandButton with the
command

  open fileview /type=open /file="$pwrp_load/sound/*"
                /target=Piano-Plc-W-DataFRead1.FileName
                /trigg=Piano-Plc-W-DataFRead1.Condition

It will open the fileview in open mode.


Fileview to restore data

When a file is selected, the filename is written to the DataFRead object in the plc program,
and also the Condition attribute is set. This will trigger a read of the specified file, and
the read data is store in the TemplateSound object connected to the DataFRead object.

Note that the plcprogram (usually with owner pwrp) has to have write access to the directory
where the files are stored, and the operator has to have read access.