<:s><:#P30670848,P4718590>The multimedia support that comes with OS/2 2.1 (called MMPM/2) allows any OS/2 program (including REXX command files) to play movies, audio files and MIDI files. MMPM/2 uses the Media Control Interface (or MCI) to provide a device-independent means of controlling multimedia devices. If you are familiar with the Windows(TM) MCI interface, OS/2's MCI is somewhat similar, although it contains a lot more function to make your programming life easier.
<:#P30670848,P943718>
<:s><:#P30670848,P1887436>This document is aimed primarily at the new MMPM/2 programmer or those who'd like to ensure that their application properly exploits MMPM/2.
@Subhead@<:#P30670848,P1149502>Device Sharing
<:#P30670848,P3774872>If you have a programming background in other multimedia environments (i.e. DOS, Windows etc.), you realize that you must go through a lot of processing in order to attempt to share the multimedia devices your program uses. Fortunately, MMPM/2 handles <+!>all<-!> of these sharing issues for you, if your program must follow these steps:
<:#P30670848,P943718>
@Bullet 1@<:s>Open the device with the MCI_OPEN_SHAREABLE flag (or use MCI_RELEASEDEVICE) to make the device shareable
@Bullet 1@Process the MM_MCIPASSDEVICE message.
<:#P30670848,P943718>
<:s><:#P30670848,P1887436>The first requirement is rather easy. Simply use the MCI_OPEN_SHAREABLE flag on the MCI_OPEN message.
<:#P30670848,P943718>
<:s><:#P30670848,P3774872>The second requirement is to process MM_MCIPASSDEVICE. This message will either indicate that you have control over, or lost control of the multimedia device. If you get the MM_MCIPASSDEVICE message informing you that you lost use of the device, <+!>your application must do an MCI_ACQUIREDEVICE before issuing another MCI command.<-!>
<:#P30670848,P943718>
<:#P30670848,P943718>The MMPM/2 toolkit contains two programs which illustrate the use of this command:
<:#P30670848,P1887436>MMPM/2 uses multi-instance audio and video drivers in order to perform the device sharing. The statement below is a pretty concise definition of what multi-instance means:
<:#P30670848,P943718>
<:#P30670848,P4718590><+!>Multi-instance<-!>: the ability for more than one OS/2 application at once to open the sound card. This is important if you want to do any serious activity with multimedia. For instance, a multi-instance driver will allow you to open the digital audio editor and hear system sounds or open a MIDI application. Without this, you must close each application down before starting another (very inconvenient).
<:#P30670848,P943718>
<:#P30670848,P943718>From the programmer's perspective, multi-instance means the following things:
<:#P30670848,P943718>
@Bullet@If you support device sharing, you support multi-instance.
<:s><:#P30670848,P3774872>If your application is not totally dependent on MMPM/2, you probably want to be able to run even if the user has not installed multimedia support. If you link directly to MMPM2.LIB and multimedia is not installed, then your application will trap when it is run. To work around this problem, you should take the following steps:
<:#P30670848,P943718>
@Bullet 1@<:s>Do a DosLoadModule on MDM.DLL (or MMIO.DLL if you are calling MMIO functions).
@Bullet 1@<:s>Do a DosQueryProcAddr address on the function you want to call (i.e. mciSendString) and save this as a function pointer.
@Bullet 1@Use the function pointer obtained in step two for your multimedia calls.
<:#P30670848,P1887436>All MCI drivers (and therefore all MCI programs) use the Multimedia I/O interface to communicate with the file system.
<:#P30670848,P943718>
<:#P30670848,P943718>This provides the following advantages:
<:#P30670848,P943718>
@Bullet 1@<:s>File format independence
@Bullet 1@Automatic format recognition
@Bullet 1@Smaller program code.
<:#P30670848,P943718>
<:#P30670848,P1887436>If your program will be accessing multimedia files directly, it is recommended that you use the MMIO interface to process the files.
<:#P30670848,P943718>
@Subhead@<:#P30670848,P1149502>Sources of Information
<:#P30670848,P943718>For information on multimedia performance and OS/2:
<:#P30670848,P943718>
@Bullet 1@See the OS/2 Developer's Connection Issue #3.
@Bullet 1@<:s>See OS/2 Developer, Multimedia Special Issue (May/June 1994).