Working (and Playing!) with REXX and OS/2 Multimedia

By Timothy F. Sipples

This are the notes of a presentation gave by Timothy F. Sipples on 15 May 1994 at the Fifth Annual REXX Symposium.

What is Multimedia?
...We like to call it ULTIMEDIA
 * Combining still images (bitmaps), animation, software motion video, text, and/or audio to present information
 * Principle technologies: CD-ROM, laserdisc, digital audio, MIDI, high resolution displays with more colors
 * Principle file formats: WAV, MID, and AVI
 * Multimedia NOT invented by Comptons

Why use Multimedia?

 * "It's the market, stupid."
 * Triggers: to "describe" events
 * Education/training
 * Kiosks (point-of-sale)
 * Presentations and demos
 * Better human interfaces generally
 * Entertainment and games

Requirements for OS/2 Multimedia

 * OS/2 2.1 with Multimedia Presentation Manager/2 (included)
 * Standard OS/2 hardware requirements
 * Some additional RAM (to 12 MB) recommended
 * CD-ROM drive
 * Audio adapter (Creative Labs, MediaVision, IBM, etc.)
 * Display with at least 256 colors recommended
 * Video capture adapter (optional)
 * Laserdisc player with computer control (optional)

Major Features in MMPM/2 1.1

 * Multimedia folder
 * Sound setup object (for system sounds)
 * Applets
 * Volume control
 * Drivers
 * Sample files
 * Lotus 1-2-3 and Excel audio macros
 * External function library for REXX and help file

Principle File Formats

 * Generally a superset of Windows file formats
 * WAV: Digital audio (pulse code modulation, and variants)
 * MID: Standard MIDI file format (for instrumental music)
 * AVI: Audio-video interleaved (IBM Ultimotion and Intel Indeo)
 * Conversion applet for some additional file formats included (AVC, VOC, DIB, DMP, ADPCM, M-Motion)
 * High degree of modularity permits addition of more file formats (e.g. FLI/FLC)

Principle REXX Features

 * Multimedia with REXX help file
 * PLAY.CMD
 * RECORD.CMD
 * Entire MCI (media control interface) command set available, not just subset described in online help
 * External function library (MCIAPI.DLL) provides access to MCI command set

Key Limitations

 * REXX is unable to deal with loss of device (meaning ACQUIRE EXCLUSIVE must be used)
 * REXX program should not hold device exclusive for long
 * Unless using PMREXX (or one of the visual REXX builders), MCI commands which require Presentation Manager (such as Ultimotion playback) will fail
 * REXX does not receive PM messages (to easily monitor the status of playback and devices)
 * MCI's implicit opens are assumed shareable (and not necessarily desired with REXX)

Sample REXX Script
/* Load and initialize Multimedia REXX support */ call RXFUNCADD 'mciRxInit','MCIAPI','mciRxInit' call mciRxInit /* Open default digital audio device, exclusive use */ rc = mciRxSendString('open waveaudio alias wave wait','RetStr','0','0') /* Check error, call function to return error string */ if rc <> 0 then do 	MacRC = mciRxGetErrorString(rc,'ErrStVar') say 'rc =' rc ', ErrStVar =' ErrStVar end /* Load a digital audio file */ rc = mciRxSendString('load wave sample.wav wait','RetStr','0','0') /* Obtain ID for device context that was just opened */ DevID = mciRxGetDeviceID(wave) say 'DevID =' DevID /* Set the time format to milliseconds */ call mciRxSendString 'set wave time format ms','RetStr','0','0' /* Determine whether the microphone connection enable */ call mciRxSendString 'connector wave query type microphone wait','RetStr','0','0' say 'connector query microphone: RetStr =' RetStr /* Query length of the opened file, value in ms */ call mciRxSendString 'status wave length wait','RetStr','0','0' say 'status wave length: RetStr =' RetStr /* Play the multimedia file, wait for completion */ call mciRxSendString 'play wave wait','RetStr','0','0' /* "Rewind" to the beginning of the file */ call mciRxSendString 'seek wave to start wait','RetStr','0','0' /* Close the device context */ call mciRxSendString 'close wave','RetStr','0','0' /* Ensure proper termination of Multimedia REXX */ call mciRxExit exit(0)

Live Demos

 * PLAY.CMD
 * FOR..DO
 * Ultimotion
 * RECORD.CMD
 * Modifications to the sample .CMD files
 * Dial 1.1 by Helge Hafting

Links

 * Additional info about the event