Saving
and Opening Files
sxOpen() | sxSave() | sxOpenSMF() |
sxSaveSMF() | sxDownload() | sxDownoadSMF() |
SequenceXtra has its own proprietary file format that can be used for saving and opening songs on disk. sxOpen() and sxSave() uses this file format.
SequenceXtra also supports the standard MIDI File format. This format uses the sxOpenSMF() and sxSaveSMF() commands. sxOpenSMF supports both Format 0 and Format1. sxSaveSMF saves all files as Format 1 files.
Both file types can be downloaded from the Internet with the sxDownload() and the sxDownloadSMF() commands.
sxOpen(mySong,
filePath or #useDialog)
sxOpen opens the a file on the local hard drive. If a filepath is used
as argument that file will open. If the symbol #useDialog is used sequenceXtra
will open a file dialog that lets the user select which file to open.
filePath must include the whole path to the file. The @-operator for relative
file paths can NOT be used.
Result code:
Negative integer: Standard error code
Positive integer: file system error
1: File not found
2: Disk full
3: Disk write protected
4: Read error
5: Write error
6: Error
20: Not a sequenceXtra song
21: File dialog cancelled by user
Example: on mouseUp global mySong sxOpen(mySong, #useDialog) -- A file dialog is presented to the end user
-- or sxOpen(mySong, the moviePath&"Musik\RockMe.sxs") -- The specified file opens end mouseUp
sxSave(mySong,
filePath or #useDialog)
sxSave saves a file on the local hard drive. If a filepath is used as
argument that file will be saved. If the symbol #useDialog is used sequenceXtra
will open a file dialog that lets the user select which file name and
location to use. filePath must include the whole path to the file. The
@-operator for relative file paths can NOT be used. If You use this function
in a Shockwave movie the user will be presented with a warning that the
application is about to save data on his/her hard drive, and offer the
option to cancel the operation.
Result code:
Negative integer: Standard error code
Positive integer: file system error
1: File not found
2: Disk full
3: Disk write protected
4: Read error
5: Write error
6: Error
20: Not a sequenceXtra song
21: File dialog cancelled by user
Example: on mouseUp global mySong sxSave(mySong, #useDialog) -- A file dialog is presented to the end user
-- or sxSave(mySong, the moviePath&"Musik\RockMe.sxs") -- The specified file opens end mouseUp
sxOpenSMF(mySong,
filePath or #useDialog)
sxOpenSMF opens the a Standard MIDI file on the local hard drive. If a
filepath is used as argument that file will open. If the symbol #useDialog
is used sequenceXtra will open a file dialog that lets the user select
which file to open. filePath must include the whole path to the file.
The @-operator for relative file paths can NOT be used.
Result code:
Negative integer: Standard error code
Positive integer: file system error
1: File not found
2: Disk full
3: Disk write protected
4: Read error
5: Write error
6: Error
20: Not a sequenceXtra song
21: File dialog cancelled by user
Example: on mouseUp global mySong sxOpenSMF(mySong, #useDialog) -- A file dialog is presented to the end user --or
sxOpenSMF(mySong, the moviePath&"Musik\RockMe.sxs") -- The specified file opens end mouseUp
sxSaveSMF(mySong,
fileName)
sxSaveSMF saves a Standard MIDI file (type 1) on the local hard drive.
If a filepath is used as argument that file will be saved. If the symbol
#useDialog is used sequenceXtra will open a file dialog that lets the
user select which file name and location to use. filePath must include
the whole path to the file. The @-operator for relative file paths can
NOT be used. If You use this function in a Shockwave movie the user will
be presented with a warning that the application is about to save data
on his/her hard drive, and offer the option to cancel the operation.
Result code:
Negative integer: Standard error code
Positive integer: file system error
1: File not found
2: Disk full
3: Disk write protected
4: Read error
5: Write error
6: Error
20: Not a sequenceXtra song
21: File dialog cancelled by user
Example: on mouseUp global mySong sxSaveSMF(mySong, #useDialog) -- A file dialog is presented to the end user -- or sxSaveSMF(mySong, the moviePath&"Musik\RockMe.sxs") -- The specified file saved end moueUp
sxDownloadSMF(mySong,URL)
sxDownladSMF downloads a standard MIDI-file from a server on the Internet. URL
must be an absoulte URL. theis command must be preceeded by preLoadNetThing(URL)
with the same URL. When the preLoadNetThing is ready sxDownloadSMF is issued
and the file is ready to play, edit etc.
In this example we use a repeat loop to check if the network operation is ready. If you have the opportunity to use an exitFrame handler for this, DO SO! A repeat loop will lock up Your system and halt all animation until the loop is finished
Result code:
Example: on mouseUp global mySong netID = preLoadNetThing("http://myServer/myFolder/mySxsFile.sxs") repeat while netDone(netID) <> 1 end repeat sxDownloadSMF(mySong,"http://myServer/myFolder/mySxsFile.sxs") sxPlay(mySong) end mouseUp
sxDownload(mySong,URL)
sxDownlad downloads a .SXS-file from a server on the Internet. URL must
be an absoulte URL. theis command must be preceeded by preLoadNetThing(URL)
with the same URL. When the preLoadNetThing is ready sxDownload is issued
and the file is ready to play, edit etc.
In this example we use a repeat loop to check if the network operation is ready. If you have the opportunity to use an exitFrame handler for this, DO SO! A repeat loop will lock up Your system and halt all animation until the loop is finished
Result code:
Example: on mouseUp global mySong netID = preLoadNetThing("http://myServer/myFolder/mySxsFile.sxs") repeat while netDone(netID) <> 1 end repeat sxDownload(mySong, "http://myServer/myFolder/mySxsFile.sxs") sxPlay(mySong) end mouseUp