|
Multimedia with Paws
This document will cover the usage of images, movies, webpages and sounds from Atlas with Wrts.
Please note that the default IO settings for the Wrts support the Atlas used in this documentation.
Please make sure that no other resources are using the sound card since it may disable the attempts for the Wrts to play the sound files.
1. With Subset/Station IEEE416.89/PAWS
First we will see what Atlas we need in order to support the multimedia IO from the Wrts:
- Declaring the output stream in the Atlas:
DECLARE, VARIABLE, 'OUT' IS FILE OF TEXT $
Once the output stream has been declared, it is possible to enable it and make use of it. We have here four examples for a wav sound, an image, a movie and a webpage.
The files that are being invoked have to be in one for the following locations:
- Same subdirectory as the .paw files if the file names are described without a path.
- The subdirectory preceding the file name if the path name is included with the file name. Please note that you need to use triple backslash to represent one backslash in the path name, ie "\\\"
Note: The length of the name, path included should not exceed 240 characters.
- This is how you can output a sound from Atlas:
ENABLE, OUTPUT TO NEW C'Sound', VIA 'OUT' $
OUTPUT, TO 'OUT', C'Sound1.WAV' $
DISABLE, 'OUT' $
In this case, we are outputting a file called "Sound1.wav".
- This is how you can output a movie from Atlas:
ENABLE, OUTPUT TO NEW C'Video', VIA 'OUT' $
OUTPUT, TO 'OUT', C'c:\\\Movie1.avi' $
DISABLE, 'OUT' $
In this case, we are outputting a file called "movie1.avi" in the root directory for the C drive. It works as well with mpg files. Please note that the example provided with Paws does not contain a path for this file and the movie1.avi resides in the same subdirectory as the project.
- This is how you can output a picture from Atlas:
ENABLE, OUTPUT TO NEW C'GRAPHICS', VIA 'OUT' $
OUTPUT, TO 'OUT', C'Graphics1.gif' $
DISABLE, 'OUT' $
In this case, we are outputting a file called "Graphics1.gif".
- This is how you can output a webpage from Atlas:
ENABLE, OUTPUT TO NEW C' HTML', VIA 'OUT' $
OUTPUT, TO 'OUT', C' http://www.tyx.com' $
DISABLE, 'OUT' $
In this case, we are outputting a file called "www.tyx.com".
Those Altas commands are part of an example that comes with the Paws distribution and is located under c:\usr\tyx\src\mmedia. You should find an Atlas files, a paw file, and all IO files that are invoked in the Atlas (avi, mpg, wav, gif).
Note: You can redefine anyone of those output IO from the Wrts and generate your own WRTS IO support for all of those files. Please refer to alternate proper documentation in order to do this.
The complete Atlas program that should be made available to you with the distribution is the following:
001000 BEGIN, ATLAS PROGRAM 'MMEDIA_SAMPLE' $
C $
10 DECLARE,
VARIABLE, 'TXT_DATA' IS STRING (80) OF CHAR $
C $
20 DECLARE,
VARIABLE, 'OUT' IS FILE OF TEXT $
C $
30 DECLARE,
VARIABLE, 'WAIT' IS BOOLEAN $
C $
C*********************************************************************$
C $
E010000 OUTPUT, C'\LF\\HT\START OF MMEDIA SAMPLE
PROGRAM\LF\' $
C $
C*********************************************************************$
C $
10 ENABLE,
OUTPUT TO NEW C'Sound', VIA 'OUT' $
C $
20 OUTPUT, TO
'OUT', C'Sound1.WAV' $
C $
30 DISABLE,
'OUT' $
C $
C*********************************************************************$
C $
40 ENABLE,
OUTPUT TO NEW C'Video', VIA 'OUT' $
C $
50 OUTPUT, TO
'OUT', C'Movie1.avi' $
C $
60 DISABLE,
'OUT' $
C $
C*********************************************************************$
C $
70 ENABLE,
OUTPUT TO NEW C'GRAPHICS', VIA 'OUT' $
C $
80 OUTPUT, TO
'OUT', C'Graphics1.gif' $
C $
90 INPUT, INTO
'WAIT' $
C $
010100 DISABLE,
'OUT' $
C $
C*********************************************************************$
C $
10 ENABLE,
OUTPUT TO NEW C'Video', VIA 'OUT' $
C $
20 OUTPUT, TO
'OUT', C'Movie2.mpg' $
C $
30 DISABLE,
'OUT' $
C $
C*********************************************************************$
C $
40 ENABLE,
OUTPUT TO NEW C'Sound', VIA 'OUT' $
C $
50 OUTPUT, TO
'OUT', C'sound2.wav' $
C $
60 DISABLE,
'OUT' $
C $
C*********************************************************************$
C $
70 ENABLE,
OUTPUT TO NEW C'HTML', VIA 'OUT' $
C $
80 OUTPUT, TO
'OUT', C'http://www.tyx.com' $
C $
90 INPUT, INTO
'WAIT' $
C $
010200 DISABLE,
'OUT' $
C $
C*********************************************************************$
C $
10 OUTPUT,
C'\HT\END OF MMEDIA SAMPLE PROGRAM\LF\' $
C $
20 TERMINATE,
ATLAS PROGRAM 'MMEDIA_SAMPLE' $
2. With Subset IEEE416
Note: There is no example provided with the Paws distribution for this subset. The Atlas for the 416 subset is slightly different and offers slightly less control over the outputs.
The name in the REQUIRE has to be the same as the one defined in the options for the Wrts.
The output string is without quotes. For a files located in the same directory as the PAW file, the name of the file itself is sufficient. If you want to include a specific path, you will need to use 3 backslashes for each backslash in the path, just like for the 89 subset.
001000 BEGIN, ATLAS PROGRAM 'MMEDIA_SAMPLE' $
C $
C $
REQUIRE,
'SOUND', OUTPUT DEVICE,
CAPABILITY,
FILE-SIZE 80 WORDS $
REQUIRE,
'VIDEO', OUTPUT DEVICE,
CAPABILITY,
FILE-SIZE
80 WORDS $
REQUIRE,
'HTML', OUTPUT DEVICE,
CAPABILITY,
FILE-SIZE 80 WORDS $
REQUIRE,
'GRAPHICS', OUTPUT DEVICE,
CAPABILITY,
FILE-SIZE 80 WORDS $
C $
C $
C*********************************************************************$
C $
E010000
OUTPUT, C'\LF\\HT\START OF MMEDIA SAMPLE PROGRAM\LF\' $
C $
C*********************************************************************$
C $
C $
OUTPUT, USING
'SOUND', Sound1.WAV $
C $
C $
C*********************************************************************$
C $
C $
OUTPUT, USING
'VIDEO', Movie1.avi $
C $
C $
C*********************************************************************$
C $
C $
OUTPUT, USING
'GRAPHICS', Graphics1.gif $
C $
C $
C*********************************************************************$
C $
C $
OUTPUT, USING
'VIDEO', Movie2.mpg $
C $
C $
C*********************************************************************$
C $
C $
OUTPUT, USING
'SOUND', sound2.wav $
C $
C $
C*********************************************************************$
C $
C $
OUTPUT, USING
'HTML', http://www.tyx.com $
C $
C $
C $
C*********************************************************************$
C $
OUTPUT,
C'\HT\END OF MMEDIA SAMPLE PROGRAM\LF\' $
C $
999999 TERMINATE,
ATLAS PROGRAM 'MMEDIA_SAMPLE' $
Note: Since there is no way to control the lifetime of the output, the window for the movie will be open only as long as the movie is open. For images and html pages, the windows for them will be open from when the Atlas is loaded to the moment with the Atlas is unloaded.
If this is a problem, you will have to generated an I/O dll that will handle the opening and closing of that window. For more information on how to do this, please refer to our other notes on the web.
|