Previous: VdDscMgr
Up: Multimedia capabilities
Next: A Multimedia Version of Ports
Previous Page: VdDscMgr
Next Page: Audio File Support

MMedUtils

MMedUtil, for ``M-Media Utilities'', is a Turbo Pascal unit that provides a Pascal interface to the commands of IBM's M-Control multimedia control software, which is a set of 2 to 4 permanently resident DOS programs accessed through software interrupt 7F. M-Control provides all driver functions for IBM's M-Motion/A multimedia audiovisual hardware, and for a few models of videodisc player. The videodisc players are controlled from the host PS/2 by an RS-232 serial connection which M-Control manages.

MMedUtil is a low-level unit that should be used as driver support by higher-level screen-control units. It is not recommended that program code, especially CAI dialogue code, use it directly, since needless compromise of portability across multimedia systems will certainly result.

This document assumes basic familiarity with the IBM M-Motion/A and M-Control program system. Manuals and release discs are found in the ETC lab.. Version 1.00 of M-Control is assumed. Later versions have already been released, but it has not been verified whether they work correctly with this unit.

unit MMedUtil;

interface

uses Graph;

const StatusMsgs: ARRAY[0..5] OF STRING[80] = ('Command Accepted', 'Unable to transmit command', 'Unsupported destination', 'Invalid length (not in [5..252])', 'Reserved, unavailable', 'Rejected, invalid in current state'); const viNameMaxLength = 40;

type {$IFDEF ExportMMotion} {$I VU-DECL.PAS} {$ELSE} viStates = (viReady, viFilmRunning, viNotReady); VideoStates = (vsNotReady, vsStill, vsForward, vsBackward, vsDiscErr, vsMiscError); StatusSet = SET OF VideoStates; ChannelSet = SET OF 1..2; mmSpeeds = 0 .. maxint; (** (viStillSpd, viPlaySpd, viScanSpd, viFastSpd);**) {$ENDIF} MMotionCmnds = BYTE; MMCmndID = BYTE; FrmAddrRng = WORD; Percentage = INTEGER; viDiscIDStr = STRING[viNameMaxLength];

var ReleasePlayer: BOOLEAN;

{$IFNDEF ExportMMotion} PROCEDURE mmInit; PROCEDURE mmGoToFrame( Number:FrmAddrRng); PROCEDURE mmStartPlayTo( EndFrame: FrmAddrRng); PROCEDURE mmStartPlayFor( FrameCount: INTEGER); PROCEDURE mmStartSndTo( EndFrame: FrmAddrRng); PROCEDURE mmStartSndFor( FrameCount: INTEGER); PROCEDURE mmStopMotion; PROCEDURE mmVideoStatus( VAR Status: StatusSet); PROCEDURE mmErase( xLeft,yTop, Width, Height: INTEGER); FUNCTION mmStatus: viStates;

PROCEDURE mmSetPlaySpeed( Rate: mmSpeeds); PROCEDURE mmSetScrnInfo( Displayed: BOOLEAN); PROCEDURE mmFreezeVideo( FreezeOn: BOOLEAN); PROCEDURE FreezeVidIn( FreezeOn: BOOLEAN); PROCEDURE mmBlockVideo( On: BOOLEAN); PROCEDURE mmSilence( SuppressSound: BOOLEAN); PROCEDURE mmSetSndChannels( NewChannels: ChannelSet); PROCEDURE mmSetVignette( xLeft,yTop, Width, Height: Percentage); PROCEDURE mmSetDispArea( xLeft,yTop, Width, Height: INTEGER);

PROCEDURE mmSetTransparency( xLeft,yTop, Width, Height: INTEGER; Transparent: BOOLEAN);

FUNCTION mmCurrentFrame: FrmAddrRng; procedure mmWhatDiscName( var VideoDiscID: viDiscIDStr);

procedure mmDefineAudio( BufSize: integer; var NewBuffer: AudioRecPtr); function mmSelectAudBuf( NewCurBuffer: AudioBuffer; var PrevBuffer: AudioBuffer): boolean; function mmRecordTo( var FileName:string; NewRecordingOfs: longint): HandleID; procedure mmCloseAudio( RecordID: byte); {$ENDIF}

PROCEDURE mmInit;

Performs the initialisation that MMedUtil requires. Must be called before any other routine in this unit.

mmInit checks whether the M-Control multimedia control program has been loaded (all its necessary components) and is running. To determine this, it simply checks for a non-zero value in interrupt vector $7f, and exits the calling program if it finds one. This version does not attempt to check for other interrupt routines, possibly changed, attached to this vector.

The M-Control manual describes the IBM programs from the M-COntrol release that need to be run to set up M-Control correctly.

PROCEDURE mmGoToFrame( Number:FrmAddrRng);

Jumps the videodisc player to frame number Number. The contents will be shown under whatever display conditions have most recently been set. NOTE: Depending on how far the play head has to jump, video noise or the player's "background" colour may be visible during the jump, before the intended video appears. This would usually be disruptive to a display; see under FreezeVidIn for controlling it.

PROCEDURE mmStartPlayTo( EndFrame: FrmAddrRng);

Starts the videodisc player playing from its current position to frame number EndFrame. The sequence is displayed (and heard, if audio is used) under whatever conditions have most recently been set. Conditions may be set that inhibit video display, if audio alone is desired. See below under mmFreezeVideo and FreezeVidIn.

PROCEDURE mmStartPlayFor( FrameCount: INTEGER);

The same as mmStartPlayTo, but plays the number of frames, starting with the current one, given by FrameCount.

PROCEDURE mmStartSndTo( EndFrame: FrmAddrRng);

From the player's current position, plays sound only until frame EndFrame. Video is not affected.

PROCEDURE mmStartSndFor( FrameCount: INTEGER);

The same as mmStartSndTo but plays for FrameCount frames.

PROCEDURE mmStopMotion;

Causes the videodisc player, if in motion, to stop. If video input and display are enabled, the contents of the frame where it stops are shown, as in mmGoToFrame. Although the players currently in use with M-Motion appear to have no effect from an mmStopMotion command when they are already stopped, it may be more robust for the caller first to issue a status check to determine whether the player is in fact in motion.

PROCEDURE mmVideoStatus( VAR Status: StatusSet);

Returns to the caller the set of all currently applicable status codes. Codes may apply to the unit itself, M-Control's status, or the status of the videodisc player.

PROCEDURE mmErase( xLeft,yTop, Width, Height: INTEGER);

Causes all video to disappear from the screen area specified at (xLeft, yTop) and extending Width pixels across and Height down. The coordinate system is that of the graphics adapter's current video mode. At this writing, that is most likely either VGA or EGA.

FUNCTION mmStatus: viStates;

PROCEDURE mmSetPlaySpeed( Rate: mmSpeeds);

Causes the player to play all subsequent video at a speed of Rate, until changed again. Since the players now in use only play audio when at normal speed, calling code should avoid using the routine for changing audio rate on any videodisc player.

Rate is expressed as a percentage of standard play speed. 100 is therefore normal speed; 50 is half speed, 200 is double speed, and so on. If according to M-Control the particular player does not support the requested speed, the nearest approximation will be used.

PROCEDURE mmSetScrnInfo( Displayed: BOOLEAN);

Sends M-Control's command to the player to switch on or off, according to Displayed, the display of information from the player superimposed on the video screen. What information is displayed varies among players, but on known machines includes at least the current frame number.

This can be valuable in precision work with frame numbers, since a player with a low-speed serial connection (2400 baud or 4800 baud, for example) to the host PC can get behind in the frame numbers it reports to the PC in response to status requests.

PROCEDURE mmFreezeVideo( FreezeOn: BOOLEAN);

This routine regulates whether video input from the player is accepted for display. If FreezeOn is TRUE, video input uptake is suppressed; if it is FALSE, video input uptake resumes.

PROCEDURE FreezeVidIn( FreezeOn: BOOLEAN);

Applies M-Motion's video protection mode to the current video display area. If FreezeOn is TRUE, the video in this area is protected from change by any further video input from the player. If FreezeOn is FALSE, this area may be updated by video input from the player. This does not affect other areas of the screen.

This functionality is important for preventing video noise from appearing in the video display area while the player is shifting the play head in response to a motion command.

PROCEDURE mmBlockVideo( On: BOOLEAN);

Applies M-Motion's graphics protect mode to the current video display area. If On is TRUE, video display is suppressed in this screen area, and text and graphics become fully visible. If On is FALSE, video is permitted to appear.

mmBlockVideo is used in this implementation to simulate clearing of the video plane of any screen area, since M-Control's actual command for erasure is exceedingly human-noticable.

PROCEDURE mmSilence( SuppressSound: BOOLEAN);

If SuppressSound is TRUE, all subsequent plays will be muted, using neither audio channel. If it is FALSE, subsequent plays will play audio according to the current sound channel specifications.

PROCEDURE mmSetSndChannels( NewChannels: ChannelSet);

Causes subsequent plays to include the audio in the sound channels given in NewChannels, except for plays done while mmSilence is suppressing sound. Passing the empty set to NewChannels has the same effect as mmSilence.

PROCEDURE mmSetVignette( xLeft,yTop, Width, Height: Percentage);

Normally, the image taken from the videodisc is the full, whole-screen image that each frame contains. This routine permits that image to be vignetted or cropped so that only the specified part of it is shown, shrunk or expanded as necessary, in the X and Y directions, to fill the current video display area.

xLeft, yTop, Width, and Height are expressed as percentages of the width and height of the original source image.

NOTE: there may well be implementation restrictions on the expansion of the source image that is possible, if a dimension of the vignette turns out to be smaller than the same dimension in the video display area on the screen.

PROCEDURE mmSetDispArea( xLeft,yTop, Width, Height: INTEGER);

mmSetDispArea takes xLeft,yTop, Width, and Height as specifying a rectangular area on the screen, and defines it to be the current video display area. This causes all subsequent display of video, whether live or still, to be reduced and positioned to this area, until such time as this routine is called again. The parameters are taken in the pixel coordinate system of the current video mode of the graphics adapter, typically EGA or VGA at this writing. This call does not in itself affect the display of any video already present on the screen.

M-Control does not oblige the area given by the parameters to have the same aspect ratio as the source video. If it does not, the video image is scaled independently in X and Y to fit the given area, with corresponding distortion of the image.

NOTE: Only if no higher-level screen control, such as Ports, is being used, should the programmer be calling this routine directly. Please see below under extensions to Ports4.3.

PROCEDURE mmSetTransparency( xLeft,yTop, Width, Height: INTEGER; Transparent: BOOLEAN);

Sets transparency of the graphics/text buffer on or off according to Transparent, for the screen area given by xLeft, yTop, Width, and Height. The parameters are taken in the pixel coordinate system of the current video mode of the graphics adapter, typically EGA or VGA at this writing.

FUNCTION mmCurrentFrame: FrmAddrRng;

Requests from the videodisc player the frame number where it's currently positioned, and returns it to the caller.

procedure mmWhatDiscName( var VideoDiscID: viDiscIDStr);

Some players are able to read identification codes or strings pressed onto each side of a videodisc. This routine uses M-Control to attempt to read an ID from the current disc; however, there is no guarantee in the present version that it will successfully return one. Nor does it have a means of telling whether it has succeeded in obtaining one. It is therefore up to the caller to examine the result for validity.



Previous: VdDscMgr
Up: Multimedia capabilities
Next: A Multimedia Version of Ports
Previous Page: VdDscMgr
Next Page: Audio File Support

Educational Technology Center
Dept. of Info. and Comp.Sci.
Univ. of California, Irvine
92717, CA, USA