home *** CD-ROM | disk | FTP | other *** search
-
- ΓòÉΓòÉΓòÉ 1. Introduction ΓòÉΓòÉΓòÉ
-
- This book discusses how you can use Media Control Interface textual string
- commands within a REXX Program to enable application control of media devices.
-
- The first section, Media Control Interface String Commands, describes the
- standard Media Control Interface string commands that are recognized by all
- media devices, as well as some common device-specific commands.
-
- The second section, Using MCI String Commands in a REXX File, describes how you
- can use string commands in a REXX file (with some limitations) rather than
- having to use the programming APIs.
-
-
- ΓòÉΓòÉΓòÉ 2. Media Control Interface Commands ΓòÉΓòÉΓòÉ
-
- The Media Control Interface (MCI) provides a view of the OS/2 multimedia system
- that is similar to that of a video and audio home entertainment system.. Each
- component in the system is known as a media device, and can be controlled by a
- set of textual string-oriented commands.
-
- Media devices can be both internal and external hardware devices. Some devices
- are compound devices and can open files, such as waveaudio or MIDI. Other
- devices are controllable external devices that can be controlled directly, such
- as a CD-ROM device or videodisc.
-
-
- ΓòÉΓòÉΓòÉ 2.1. Standard String Commands - Introduction ΓòÉΓòÉΓòÉ
-
- There are standard Media Control Interface string commands that are recognized
- by all devices. MCI devices are required to support the use of these commands.
- Extended commands can add other options to these commands.
-
- In addition to the standard Media Control Interface string commands, each
- device also supports a set of commands specific to its device type. Where
- possible, these type-specific commands are identical between types. For
- example, the basic PLAY command is identical for videodisc, wave audio, and CD
- audio players.
-
- The format of the strings follows. Select one of the highlighted words for
- additional information:
-
- COMMAND OBJECT [KEYWORDS] [WAIT]
-
- For commands which return string information, such as CAPABILITY and STATUS,
- the WAIT keyword is required.
-
- Examples:
-
- o Open the file foo.wav, give it the wave alias: open foo.wav alias wave wait
- o Open the default compact disc device, give it the CD alias: open cdaudio
- alias cd wait
- o Open the second of two audio devices, give it the wave2 alias: open
- waveaudio02 alias wave2 wait
- o Play foo.wav, using the wave alias: play wave wait
-
- Proceed to the next panel for a list of the standard commands.
-
-
- ΓòÉΓòÉΓòÉ <hidden> Command Object ΓòÉΓòÉΓòÉ
-
- The object associated with a Media Control Interface command can be one of the
- following:
-
- o Device type - The default device of a given type. The possible types of
- controllable devices include the following:
-
- Videotape - A videotape player or recorder.
- Videodisc - A videodisc player.
- CDaudio - A CD-ROM device which supports standard compact disc playback.
- Waveaudio - A device which supports digital audio files ("sound board").
- Sequencer - A device which supports MIDI files.
- Digitalvideo - A device which supports audio/video files, either
- hardware-assisted or software motion video-only.
-
- If you have multiple devices of the same type, the MMPM/2 Multimedia Setup
- program allows you to decide which device should be the default for that type.
-
- o Device name - A name of a particular device. Device names are of the form
- DevicetypeNN, where Devicetype is one of the device types given above, and NN
- is a value (01, 02,...) indicating which device of that type is to be
- controlled.
-
- o Filename - The name of a file to be opened or controlled. When a filename is
- opened, MMPM/2 first examines the file's extension, then its type, to
- determine which device is associated to the file.
-
- o Alias - A string that was specified on a previous OPEN command. This string
- can then be used as the object name in subsequent commands.
-
-
- ΓòÉΓòÉΓòÉ 2.2. Command List ΓòÉΓòÉΓòÉ
-
-
- ΓòÉΓòÉΓòÉ <hidden> Commands ΓòÉΓòÉΓòÉ
-
- Select a command for more information:
-
- o ACQUIRE
- o CAPABILITY
- o CLOSE
- o CONNECTOR
- o INFO
- o LOAD
- o OPEN
- o PAUSE
- o PLAY
- o RECORD
- o RELEASE
- o RESUME
- o SAVE
- o SEEK
- o SET
- o STATUS
- o STOP
-
-
- ΓòÉΓòÉΓòÉ <hidden> ACQUIRE ΓòÉΓòÉΓòÉ
-
- ACQUIRE object items WAIT Gains the use of the physical resources associated
- with the object.
-
- The following optional items modify the basic command:
-
- o exclusive
- o exclusive instance
- o queue
-
-
- ΓòÉΓòÉΓòÉ <hidden> exclusive ΓòÉΓòÉΓòÉ
-
- Obtains exclusive use of the resources associated with the object. No other
- applications can obtain use of the device until the RELEASE command is
- executed.
-
-
- ΓòÉΓòÉΓòÉ <hidden> exclusive instance ΓòÉΓòÉΓòÉ
-
- Obtains exclusive use of only the resources needed by the object. Other
- applications may be able to use the same device concurrently, depending upon
- the number and types of resources they require.
-
-
- ΓòÉΓòÉΓòÉ <hidden> queue ΓòÉΓòÉΓòÉ
-
- Requests use of the resources associated with the object. If another
- application has exclusive use of the same physical resources, then this command
- will wait until the resources can be acquired.
-
-
- ΓòÉΓòÉΓòÉ <hidden> CAPABILITY ΓòÉΓòÉΓòÉ
-
- CAPABILITY object items WAIT Requests information about a particular capability
- of a device. The WAIT keyword must be specified in order to
- receive the returned string information. While other
- capabilities are defined for specific devices and device
- types, the following items can always be specified:
-
- o can record
- o has audio
- o has video
- o can eject
- o can play
- o can save
- o compound device
- o uses files
- o can lockeject
- o can setvolume
- o preroll type
- o preroll time
- o device type
- o message item
-
-
- ΓòÉΓòÉΓòÉ <hidden> can record ΓòÉΓòÉΓòÉ
-
- Returns true if the device supports recording.
-
-
- ΓòÉΓòÉΓòÉ <hidden> has audio ΓòÉΓòÉΓòÉ
-
- Returns true if the device supports audio playback.
-
-
- ΓòÉΓòÉΓòÉ <hidden> has video ΓòÉΓòÉΓòÉ
-
- Returns true if the device supports video playback.
-
-
- ΓòÉΓòÉΓòÉ <hidden> can eject ΓòÉΓòÉΓòÉ
-
- Returns true if the device can eject the media.
-
-
- ΓòÉΓòÉΓòÉ <hidden> can play ΓòÉΓòÉΓòÉ
-
- Returns true if the device can play.
-
-
- ΓòÉΓòÉΓòÉ <hidden> can save ΓòÉΓòÉΓòÉ
-
- Returns true if the device can save data.
-
-
- ΓòÉΓòÉΓòÉ <hidden> compound device ΓòÉΓòÉΓòÉ
-
- Returns true if the device requires an element name.
-
-
- ΓòÉΓòÉΓòÉ <hidden> uses files ΓòÉΓòÉΓòÉ
-
- Returns true if the device requires a file path name.
-
-
- ΓòÉΓòÉΓòÉ <hidden> can lockeject ΓòÉΓòÉΓòÉ
-
- Returns true if the device can disable the manual ejection of the media.
-
-
- ΓòÉΓòÉΓòÉ <hidden> can setvolume ΓòÉΓòÉΓòÉ
-
- Returns true if the device supports software control of volume level.
-
-
- ΓòÉΓòÉΓòÉ <hidden> preroll type ΓòÉΓòÉΓòÉ
-
- Returns the preroll characteristics of the device: Returns notified if the
- preroll time for the device is variable. Returns deterministic if the prerolled
- time for the device is fixed. Returns none if the device does not support
- preroll.
-
-
- ΓòÉΓòÉΓòÉ <hidden> preroll time ΓòÉΓòÉΓòÉ
-
- Returns the deterministic or maximum notified preroll time in MMTIME units. A
- value of 0 for a notified preroll device indicates the preroll time is not
- bounded.
-
-
- ΓòÉΓòÉΓòÉ <hidden> device type ΓòÉΓòÉΓòÉ
-
- Returns one of the following:
-
- o animation
- o ampmix
- o cdaudio
- o cdxa
- o digitalvideo
- o overlay
- o sequencer
- o videodisc
- o waveaudio
- o other
-
-
- ΓòÉΓòÉΓòÉ <hidden> message item ΓòÉΓòÉΓòÉ
-
- Returns true if the device supports the message specified by item.
-
-
- ΓòÉΓòÉΓòÉ <hidden> CLOSE ΓòÉΓòÉΓòÉ
-
- CLOSE object Closes the device context and frees resources. The object to
- close should be the same one used when the device context was
- initially opened.
-
- Select the following word for an example of how to use the CLOSE command.
-
- Example:
-
-
- ΓòÉΓòÉΓòÉ <hidden> CONNECTOR ΓòÉΓòÉΓòÉ
-
- CONNECTOR object action items Enables, disables, or queries the status of
- connectors on a device.
-
- An action must be specified. The possible values are:
-
- enable Enables information flow through the indicated connector. Use of
- this option requires that the number or type options, or both must
- also be specified.
- disable Disables information flow through the indicated connector. Use of
- this option requires that the number or type options, or both must
- also be specified.
- query Queries the status of the indicated connector. The return value
- will be either "true" or "false" to indicate enabled or disabled
- respectively. Use of this option requires that the number or type
- options, or both must also be specified.
-
- The following items modify the basic command:
-
- o number <connector_number>
- o type <connector_type>
-
- Examples:
-
- o Query the waveaudio device to determine whether the line in connector is
- enabled:
-
- connector waveaudio query type line in wait
-
- o Enable the microphone connector of the device opened with alias wave:
-
- connector wave enable type microphone
-
-
- ΓòÉΓòÉΓòÉ <hidden> number <connector_number> ΓòÉΓòÉΓòÉ
-
- The connector number on which to perform the requested action. If this item is
- omitted, the first connector is assumed. If the type item is included, then
- the connector number is interpreted as a relative offset within the specified
- connector type.
-
-
- ΓòÉΓòÉΓòÉ <hidden> type <connector_type> ΓòÉΓòÉΓòÉ
-
- The type of connector to which the requested action applies. The following
- connector types are defined:
-
- MIDI stream
-
- Digital input or output for a sequencer device. This data is typically
- streamed to an amplifier mixer device.
- CD stream
-
- Digital output for a CD audio device capable of reading the data directly
- off of a disk. The data is typically streamed to an amplifier mixer
- device.
- wave stream
-
- Digital input or output for a waveform audio device. The data is typically
- streamed to an amplifier mixer device.
- XA stream
-
- Digital output for a CD-ROM/XA device. The data is typically streamed to
- an amplifier mixer device.
- amp stream
-
- Digital input or output for an amplifier mixer device.
- headphones
-
- The connector on the device which is labeled or is typically used to attach
- headphones to the device.
- speakers
-
- The connector on the device which is labeled or is typically used to attach
- speakers to the device.
- microphone
-
- The connector on the device which is labeled or is typically used to attach
- a microphone to the device.
- line in
-
- The connector on the device which is labeled or is typically used to
- provide line level input to the device.
- line out
-
- The connector on the device which is labeled or is typically used to
- provide line level output from the device.
- video in
-
- The connector on the device which is labeled or is typically used to
- provide video input to the device.
- video out
-
- The connector on the device which is labeled or is typically used to
- provide video output from the device.
-
-
- ΓòÉΓòÉΓòÉ <hidden> INFO ΓòÉΓòÉΓòÉ
-
- INFO object product Returns a string identifying product information associated
- with the object.
-
- For example, if you have an IBM audio adapter, you would issue:
-
- info waveaudio product
-
- One possible return string is "IBM M-Audio Adapter".
-
-
- ΓòÉΓòÉΓòÉ <hidden> product ΓòÉΓòÉΓòÉ
-
- Returns a description of the hardware associated with a device. This usually
- includes the manufacturer and model information.
-
-
- ΓòÉΓòÉΓòÉ <hidden> LOAD ΓòÉΓòÉΓòÉ
-
- LOAD object Loads a new device element (file) into a previously opened
- device context.
-
- The following item modifies the basic command:
-
- o filename
-
- Note: If you wish to load and play a digital video file using REXX programs,
- then you should run the REXX program using PMREXX. See the section
- entitled REXX Command File Limitations section for other restrictions.
-
- Select the following word for an example of how to use the LOAD command.
-
- Example:
-
-
- ΓòÉΓòÉΓòÉ <hidden> filename ΓòÉΓòÉΓòÉ
-
- Name of the file to be loaded. NEW is a reserved filename, which instructs
- MMPM/2 to open an untitled file (use the SAVE command to save this file).
-
-
- ΓòÉΓòÉΓòÉ <hidden> OPEN ΓòÉΓòÉΓòÉ
-
- OPEN object items Opens a specific device context for subsequent manipulation.
-
- The following items modify the basic command:
-
- o shareable
- o type device_type
- o alias device_alias
-
- A number representing the opened context, called the device ID, is returned
- upon successful completion of the OPEN command.
-
- Select the following word for an example of how to use the OPEN command.
-
- Example:
-
-
- ΓòÉΓòÉΓòÉ <hidden> shareable ΓòÉΓòÉΓòÉ
-
- Initializes the device as shareable. Specifying shareable makes the resources
- of the device available to other device contexts. If shareable is not
- specified with open, the resource will be exclusively acquired when the device
- is opened.
-
-
- ΓòÉΓòÉΓòÉ <hidden> type device_type ΓòÉΓòÉΓòÉ
-
- Specifies the compound device used to control a device element. As an
- alternative to type, Media Control Interface can use the extended attributes or
- file extensions associated with the file to select the controlling device.
-
-
- ΓòÉΓòÉΓòÉ <hidden> alias device_alias ΓòÉΓòÉΓòÉ
-
- Specifies an alternate name for the given device. If an alias is specified, it
- must be used in subsequent references to avoid automatic open.
-
- OPEN returns a device ID that is used for subsequent calls for procedure
- interface, if desired.
-
-
- ΓòÉΓòÉΓòÉ <hidden> PAUSE ΓòÉΓòÉΓòÉ
-
- PAUSE object Stops playing. The difference between PAUSE and STOP is
- device dependent. On video devices, PAUSE generally
- continues to display the last frame, whereas STOP causes the
- display to blank. A device that is paused can frequently
- begin playing again with less latency than if it were
- stopped.
-
-
- ΓòÉΓòÉΓòÉ <hidden> PLAY ΓòÉΓòÉΓòÉ
-
- PLAY object items Begin playing the file or device.
-
- The following items modify the basic command:
-
- o from pos
- o to pos
-
- Select the following word for an example of how to use the PLAY command.
-
- Example:
-
-
- ΓòÉΓòÉΓòÉ <hidden> from pos ΓòÉΓòÉΓòÉ
-
- Specifies the position at which to start playing. If this keyword is omitted,
- the device starts playing at the current position.
-
-
- ΓòÉΓòÉΓòÉ <hidden> to pos ΓòÉΓòÉΓòÉ
-
- Specifies the position at which to stop playing. If this keyword is omitted,
- the device plays to the end of the media.
-
-
- ΓòÉΓòÉΓòÉ <hidden> RECORD ΓòÉΓòÉΓòÉ
-
- RECORD object items Starts recording data. By default, recording does not
- overwrite existing data but rather inserts data at the
- current position. On devices (such as audio or video tape)
- that cannot support inserting data, recording overwrites
- existing data by default.
-
- The following items modify the basic command:
-
- o insert
- o overwrite
- o from pos
- o to pos
-
-
- ΓòÉΓòÉΓòÉ <hidden> insert ΓòÉΓòÉΓòÉ
-
- Data is to be added to the device element. This is the default on devices that
- support insertion of data (file-oriented devices). An error is returned if the
- device does not support INSERT.
-
-
- ΓòÉΓòÉΓòÉ <hidden> overwrite ΓòÉΓòÉΓòÉ
-
- Recorded data replaces existing data in the device element. This is the default
- on devices that do not support insertion of data (for example, videotape).
-
-
- ΓòÉΓòÉΓòÉ <hidden> from pos ΓòÉΓòÉΓòÉ
-
- Specifies the position at which to start recording. If this keyword is omitted,
- the device starts recording at the current position.
-
-
- ΓòÉΓòÉΓòÉ <hidden> to pos ΓòÉΓòÉΓòÉ
-
- Specifies the position at which to start or stop recording. If this keyword is
- omitted, the device records to the end of the media.
-
-
- ΓòÉΓòÉΓòÉ <hidden> RELEASE ΓòÉΓòÉΓòÉ
-
- RELEASE object [return resource] Notifies MMPM/2 that the physical resources
- associated with the object are no longer required.
-
- Control of the physical device is not necessarily lost when the command is
- executed.
-
- If the return resource keywords are specified, then control of the physical
- resources for a given device will be given to the last application which lost
- it.
-
-
- ΓòÉΓòÉΓòÉ <hidden> RESUME ΓòÉΓòÉΓòÉ
-
- RESUME object Resumes playing or recording from a paused state, keeping
- previously specified settings in effect.
-
-
- ΓòÉΓòÉΓòÉ <hidden> SAVE ΓòÉΓòÉΓòÉ
-
- SAVE object [filename] Saves data for the device.
-
-
- ΓòÉΓòÉΓòÉ <hidden> filename ΓòÉΓòÉΓòÉ
-
- The destination path and name of the file to be saved. If a filename was
- specified during the LOAD command, then you do not need to specify a filename
- when saving the file; the data will be saved using the current filename.
-
- If an untitled file was loaded, then a filename must be specified, or an error
- will be returned.
-
-
- ΓòÉΓòÉΓòÉ <hidden> SEEK ΓòÉΓòÉΓòÉ
-
- SEEK object items Finds the specified position and stops.
-
- The following items modify the basic command:
-
- o to pos
- o to start
- o to end
-
- Select the following word for an example of how to use the SEEK command.
-
- Example:
-
-
- ΓòÉΓòÉΓòÉ <hidden> to pos ΓòÉΓòÉΓòÉ
-
- The position at which to stop the seek.
-
-
- ΓòÉΓòÉΓòÉ <hidden> to start ΓòÉΓòÉΓòÉ
-
- Seek to the beginning of the media.
-
-
- ΓòÉΓòÉΓòÉ <hidden> to end ΓòÉΓòÉΓòÉ
-
- Seek to the end of the media.
-
-
- ΓòÉΓòÉΓòÉ <hidden> SET ΓòÉΓòÉΓòÉ
-
- SET object items Establishes the desired setttings for the object being
- controlled.
-
- The following items modify the basic command:
-
- o audio
- o door closed
- o door open
- o door locked
- o door unlocked pos
- o master MIDI
- o master none
- o master SMPTE
- o slave file
- o slave MIDI
- o slave none
- o slave SMPTE
- o time format milliseconds
- o time format MMTIME
- o speed format percentage
- o speed format fps
- o video off
- o video on
-
- Select the following word for an example of how to use the SET command.
-
- Example:
-
-
- ΓòÉΓòÉΓòÉ <hidden> audio items ΓòÉΓòÉΓòÉ
-
- Sets the audio attributes of the device context specified by items.
-
- all
- Apply to both or all of the channels (default).
- left
- Apply to left channel.
- right
- Apply to right channel.
- volume percentage
- Set the device/mixer channel volume level.
- on
- Enable audio output.
- off
- Disable audio output.
- over milliseconds
-
- Apply the change over the specified time period (fade).
-
-
- ΓòÉΓòÉΓòÉ <hidden> door closed ΓòÉΓòÉΓòÉ
-
- Retracts the tray and closes the door, if possible.
-
-
- ΓòÉΓòÉΓòÉ <hidden> door open ΓòÉΓòÉΓòÉ
-
- Opens the door and ejects the tray, if possible.
-
-
- ΓòÉΓòÉΓòÉ <hidden> door locked ΓòÉΓòÉΓòÉ
-
- Locks the media cover on the device (if any). This disables manual ejection of
- the media from the device.
-
-
- ΓòÉΓòÉΓòÉ <hidden> door unlocked ΓòÉΓòÉΓòÉ
-
- Unlocks the media cover on the device (if any). This enables manual ejection
- of the media from the device.
-
-
- ΓòÉΓòÉΓòÉ <hidden> master MIDI ΓòÉΓòÉΓòÉ
-
- Sets the MIDI sequencer as the synchronization source. Synchronization data is
- sent in MIDI format. The IBM sequencer does not support this option.
-
-
- ΓòÉΓòÉΓòÉ <hidden> master none ΓòÉΓòÉΓòÉ
-
- Inhibits the sequencer from sending synchronization data. The IBM sequencer
- does not support this option.
-
-
- ΓòÉΓòÉΓòÉ <hidden> master SMPTE ΓòÉΓòÉΓòÉ
-
- Sets the MIDI sequencer as the synchronization source. Synchronization data is
- sent in SMPTE format. The IBM sequencer does not support this option.
-
-
- ΓòÉΓòÉΓòÉ <hidden> slave file ΓòÉΓòÉΓòÉ
-
- Sets the MIDI sequencer to use file data as the synchronization source. This
- is the default.
-
-
- ΓòÉΓòÉΓòÉ <hidden> slave MIDI ΓòÉΓòÉΓòÉ
-
- Sets the MIDI sequencer to use incoming data, with the MIDI file for the
- synchronization source. The sequencer recognizes synchronization data with the
- MIDI format. The IBM sequencer does not support this option.
-
-
- ΓòÉΓòÉΓòÉ <hidden> slave none ΓòÉΓòÉΓòÉ
-
- Sets the MIDI sequencer to ignore synchronization data.
-
-
- ΓòÉΓòÉΓòÉ <hidden> slave SMPTE ΓòÉΓòÉΓòÉ
-
- Sets the MIDI sequencer to use incoming MIDI data for the synchronization
- source. The sequencer recognizes synchronization data with the SMPTE format.
- The IBM sequencer does not support this option.
-
-
- ΓòÉΓòÉΓòÉ <hidden> timed format milliseconds ΓòÉΓòÉΓòÉ
-
- Sets the time format, to milliseconds. You can abbreviate milliseconds as ms.
-
-
- ΓòÉΓòÉΓòÉ <hidden> timed format MMTIME ΓòÉΓòÉΓòÉ
-
- Sets the time format, to MMTIME. There are 3000 MMTIME units per second.
-
-
- ΓòÉΓòÉΓòÉ <hidden> speed format percentage ΓòÉΓòÉΓòÉ
-
- Set the speed format, to percentage.
-
-
- ΓòÉΓòÉΓòÉ <hidden> speed format fps ΓòÉΓòÉΓòÉ
-
- Set the speed format, to frames-per-second.
-
-
- ΓòÉΓòÉΓòÉ <hidden> video off ΓòÉΓòÉΓòÉ
-
- Disables video output.
-
-
- ΓòÉΓòÉΓòÉ <hidden> video on ΓòÉΓòÉΓòÉ
-
- Enables video output.
-
-
- ΓòÉΓòÉΓòÉ <hidden> STATUS ΓòÉΓòÉΓòÉ
-
- STATUS object items Obtains status information for the device.
-
- The following items modify the basic command:
-
- o Keywords common to all devices:
-
- - length
- - mode
- - position
- - ready
- - time format
- - volume
-
- o Device-specific keywords:
-
- - current track
- - length track number
- - number of tracks
- - position in track
- - position track number
- - speed format
-
- Select the following word for an example of how to use the STATUS command.
-
- Example:
-
-
- ΓòÉΓòÉΓòÉ <hidden> current track ΓòÉΓòÉΓòÉ
-
- Returns the current track.
-
-
- ΓòÉΓòÉΓòÉ <hidden> length ΓòÉΓòÉΓòÉ
-
- Returns the total length of the segment.
-
-
- ΓòÉΓòÉΓòÉ <hidden> length track number ΓòÉΓòÉΓòÉ
-
- Returns the length of the track specified by number.
-
-
- ΓòÉΓòÉΓòÉ <hidden> mode ΓòÉΓòÉΓòÉ
-
- Returns the current mode of the device: not ready, stopped, playing, seeking,
- recording, paused, or other.
-
-
- ΓòÉΓòÉΓòÉ <hidden> number of tracks ΓòÉΓòÉΓòÉ
-
- Returns the number of tracks on the media.
-
-
- ΓòÉΓòÉΓòÉ <hidden> position ΓòÉΓòÉΓòÉ
-
- Returns the current position.
-
-
- ΓòÉΓòÉΓòÉ <hidden> position track number ΓòÉΓòÉΓòÉ
-
- Returns the position of the start of the track specified by number.
-
-
- ΓòÉΓòÉΓòÉ <hidden> position in track ΓòÉΓòÉΓòÉ
-
- Returns the current position relative to the beginning of the track.
-
-
- ΓòÉΓòÉΓòÉ <hidden> ready ΓòÉΓòÉΓòÉ
-
- Returns true if the device is ready.
-
-
- ΓòÉΓòÉΓòÉ <hidden> time format ΓòÉΓòÉΓòÉ
-
- Returns the time format.
-
-
- ΓòÉΓòÉΓòÉ <hidden> speed format ΓòÉΓòÉΓòÉ
-
- Returns the speed format.
-
-
- ΓòÉΓòÉΓòÉ <hidden> volume ΓòÉΓòÉΓòÉ
-
- Returns the current volume setting. The volume is returned as a string in the
- format left:right where left and right are percentages of the maximum
- achievable effect for the left and right channels respectively. Leading zeros
- are suppressed for the volume level in each channel.
-
-
- ΓòÉΓòÉΓòÉ <hidden> STOP ΓòÉΓòÉΓòÉ
-
- STOP object Stops the device.
-
- Select the following word for an example of how to use the STOP command.
-
- Example:
-
-
- ΓòÉΓòÉΓòÉ <hidden> String Command Examples ΓòÉΓòÉΓòÉ
-
- The following string command example is used to play a digital audio file.
-
- open waveaudio alias w shareable wait
- load w sound.wav wait
- set w time format ms wait
- setpositionadvise w on every 500 wait
- play
- seek w to 0 wait
- play
- close w wait
-
- The following string command example is used to play a CD.
-
- open cdaudio alias c shareable wait
- set w time format ms wait
- setpositionadvise w on every 500 wait
- play
- stop w wait
- close w wait
-
-
- ΓòÉΓòÉΓòÉ <hidden> String Command Examples ΓòÉΓòÉΓòÉ
-
- This example shows opening a CD player and playing the entire CD. The status
- commands let the application know if a CD is present and the drive is ready.
- The SET command will set the time base to milliseconds for all future commands.
-
- open cdaudio01 alias cdaud1 shareable wait
- status cdaud1 media present wait
- status cdaud1 mode wait
- set cdaud1 time format milliseconds wait
- seek cdaud1 to start wait
- play cdaud1
- close cdaud1 wait
-
-
- ΓòÉΓòÉΓòÉ 3. Using MCI String Commands in a REXX File ΓòÉΓòÉΓòÉ
-
- If you are a REXX-knowledgeable user, you can use Media Control Interface
- string commands in a REXX file (with some limitations) rather than having to
- use the programming APIs. For example, you can:
-
- o Start a REXX command file using the MCI string interface commands.
- o End a REXX command file with the MCI string interface commands.
- o Send a MCI command string.
- o Get a MCI error string.
- o Get the device ID associated with an MCI device alias.
-
- REXX is not designed to be a fully-functional multimedia scripting language.
- Support is provided for fundamental multimedia capabilities only. See the REXX
- Command File Limitations section for further information.
-
- Note: For more information about programming in REXX, see the REXX
- Information online manual, which, if it was selected during
- installation, is located in the Information folder.
-
-
- ΓòÉΓòÉΓòÉ 3.1. REXX Command File Limitations ΓòÉΓòÉΓòÉ
-
- In order to manage MCI resources and devices using REXX command files
- effectively, you should first note the following:
-
- o Since a REXX command file can not receive notification when it is losing or
- gaining access to an MCI device, it should open the devices exclusively.
- Commands should be sent with the wait keyword. If the device is opened with
- the shareable flag, the command file must be careful to do ACQUIRE EXCLUSIVE
- and RELEASE RETURN RESOURCE commands around its other device commands;
- otherwise, subsequent commands may fail with an error indicating an inactive
- instance.
-
- It is possible that the ACQUIRE EXCLUSIVE command will fail if the device is
- in use by another program; the command file should handle this situation.
- Exclusive opens may also fail if the device is in use by another program.
-
- o A REXX command file should not hold the device open exclusive for long
- periods of time.
-
- o REXX is typically running in a non-PM session, even if it is run from a
- windowed command prompt. Therefore, MCI commands that require PM will fail.
-
- Digital video, image devices, or clipboard cut-and-paste commands will not
- function properly in this environment. Use PMREXX to execute a REXX command
- file that uses digital video.
-
- o REXX does not receive PM messages; notify commands will return an error.
- REXX supports synchronous commands with the wait flag, and asynchronous
- commands without the wait flag. However, the command file is not notified
- when the operation completes. It is possible to poll the device in some
- situations by doing a status mode to determine when the file has finished
- playing.
-
- o The MCI string interface is capable of doing implicit opens when a command is
- issued on a media object without opening the device. For example, `play
- clock.wav wait'. will implicitly open and close the waveaudio device.
- However, these opens are shareable, and could cause you to lose access of the
- device.
-
-
- ΓòÉΓòÉΓòÉ 3.2. mciRxInit ΓòÉΓòÉΓòÉ
-
- Function: mciRxInit
-
- Syntax: call mciRxInit
-
- Purpose: Initialize a REXX command file so that MCI string interface commands
- may be used.
-
- Parameters: None.
-
- Returns: Returns type of failure if a failure occurs, otherwise 0 for
- successful.
-
- Remarks: This function must be called in order to have the other MCI REXX API
- registered properly. See the REXX Program Example section for a programming
- example.
-
- This function is registered in REXX by the following REXX code:
-
-
- Call RXFUNCADD "mciRxInit", "MCIAPI", "mciRxInit"
- Call mciRxInit
-
-
- ΓòÉΓòÉΓòÉ 3.3. mciRxExit ΓòÉΓòÉΓòÉ
-
- Function: mciRxExit
-
- Syntax: call mciRxExit
-
- Purpose: Terminate a REXX command file that contains MCI string commands.
-
- Parameters: None.
-
- Returns: Returns type of failure if a failure occurs, otherwise 0 for
- successful.
-
- Remarks: This function must be called so that allocated resources can be
- returned to the system. See the REXX Program Example section for an
- illustration of this command.
-
-
- ΓòÉΓòÉΓòÉ 3.4. mciRxGetDeviceID ΓòÉΓòÉΓòÉ
-
- Function: mciRxGetDeviceID
-
- Syntax: DevID = mciRxGetDeviceID(alias)
-
- Purpose: Get the device ID associated with an MCI device alias.
-
- Parameters:
-
- alias - input The device alias that was specified on a previous OPEN command.
-
- Returns : DevID - A device ID number. This is the same value that is returned
- from a successful OPEN command.
-
- See the REXX Program Example section for an illustration of this command.
-
-
- ΓòÉΓòÉΓòÉ 3.5. mciRxGetErrorString ΓòÉΓòÉΓòÉ
-
- Function: mciRxGetErrorString
-
- Syntax: frc = mciRxGetErrorString (rc, 'errstr')
-
- Purpose: Get an MCI error string.
-
- Parameters:
-
- rc - input Return code from an MCI REXX function.
-
- errstr - output REXX variable name in which to store the returned error string.
- The variable name must be enclosed in quotes.
-
- Returns: frc - return code. This is 0 if the function completed successfully.
- errstr contains a string describing the return code that was supplied as a
- parameter.
-
- Remarks: See the REXX Program Example section for an illustration of this
- command.
-
-
- ΓòÉΓòÉΓòÉ 3.6. mciRxSendString ΓòÉΓòÉΓòÉ
-
- Function: mciRxSendString
-
- Syntax: rc = mciRxSendString (cmdstr, 'retstrvar', reserved1, reserved2)
-
- Purpose: Send a MCI command string.
-
- Parameters:
-
- cmdstr - input MCI command string.
-
- retstrvar - output REXX variable name to store the return string from the MCI
- command. This variable should be enclosed in quotes.
-
- reserved1 - input Reserved field should be set to 0.
-
- reserved2 - input Reserved field should be set to 0.
-
- Returns: rc - return code. This value is 0 if the command was successful,
- otherwise it is an MMPM/2 error code. The retstrvar variable specified may
- contain string information, depending upon the command.
-
- Remarks: See the REXX Program Example section for an illustration of this
- command.
-
-
- ΓòÉΓòÉΓòÉ 3.7. REXX Program Example ΓòÉΓòÉΓòÉ
-
- When MMPM/2 is installed, two REXX command files are placed in the \MMOS2
- directory:
-
- o PLAY.CMD - Allows you to play a multimedia file or device
- o RECORD.CMD - Allows you to record digital audio data from a microphone to a
- specified filename.
-
- The following OS/2 REXX program illustrates how to use the multimedia REXX and
- Media Control Interface commands to open, query, set, and manipulate a
- multimedia file:
-
- /* Load and initialize Multimedia REXX support */
- call RXFUNCADD 'mciRxInit','MCIAPI','mciRxInit'
- call mciRxInit
-
- /* Open the default digital audio device for exclusive use */
- rc = mciRxSendString('open waveaudio alias wave wait', 'RetStr', '0', '0')
-
- /* Check for an error, call a function to return an 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 the ID for the 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 the length of the opened file, value is in millseconds */
- 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)
-
-
- ΓòÉΓòÉΓòÉ 3.7.1. PLAY.CMD ΓòÉΓòÉΓòÉ
-
- Syntax:
-
- PLAY FILE=filename|DEV=device [TIMEFMT=timefmt] [FROM=from] [TO=to]
-
- Purpose: Play a multimedia file or device.
-
- Parameters:
-
- FILE=filename Name of the file to be played back.
-
- DEV=device Name of the desired device to be used for playback.
-
- TIMEFMT=timefmt The time format to be used, usually associated with the FROM=
- and TO= parameters.
-
- FROM=from The starting position within the file or device to begin playback.
- This value is in MMTIME units, unless TIMEFMT= was specified.
-
- TO=to The position within the file or device to stop playback. This value
- is in MMTIME units, unless TIMEFMT= was specified.
-
- Remarks: Either FILE=filename or DEV=device must be specified (both can be
- provided, to play a file on a specific device).
-
-
- ΓòÉΓòÉΓòÉ 3.7.2. RECORD.CMD ΓòÉΓòÉΓòÉ
-
- Syntax: RECORD filename
-
- Purpose: Record digital audio from the microphone of the default waveaudio
- device to the specified filename.
-
- Parameters:
-
- filename The name of the file to contain the recorded digital audio data.
-
-
- ΓòÉΓòÉΓòÉ <hidden> ΓòÉΓòÉΓòÉ
-
- Keywords are command-specific. Reference the Commands section for details
- about keywords for a specific command.
-
-
- ΓòÉΓòÉΓòÉ <hidden> ΓòÉΓòÉΓòÉ
-
- The keyword WAIT can be used on any command. It instructs MMPM/2 to wait until
- the command is completed before returning.