home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 14 Text
/
14-Text.zip
/
mmintr.zip
/
mmintro.asc
next >
Wrap
Text File
|
1994-02-13
|
5KB
|
241 lines
OS/2 Multimedia Basics
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.
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.
Device Sharing
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:
Open the device with the MCI_OPEN_SHAREABLE flag (or use
MCI_RELEASEDEVICE) to make the device shareable
Process the MM_MCIPASSDEVICE message.
The first requirement is rather easy. Simply use the
MCI_OPEN_SHAREABLE flag on the MCI_OPEN message.
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.
The MMPM/2 toolkit contains two programs which illustrate the
use of this command:
The recorder sample
Clock example
Multi-Instance Drivers
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:
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).
From the programmer's perspective, multi-instance means the
following things:
If you support device sharing, you support multi-instance.
Multimedia Awareness
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:
Do a DosLoadModule on MDM.DLL (or MMIO.DLL if you are calling
MMIO functions).
Do a DosQueryProcAddr address on the function you want to call
(i.e. mciSendString) and save this as a function pointer.
Use the function pointer obtained in step two for your
multimedia calls.
Unique OS/2 MCI Commands
The following MCI commands are unique to MMPM/2 and can really
maximize this 32-bit environment:
MCI_SETPOSITIONADVISE. Allows your application to be notified
on a recurring basis about the current media position.
MCI_SETCUEPOINT. Allows notification at specified media
positions.
MCI_UNDO/MCI_REDO/MCI_CUT/MCI_COPY/MCI_PASTE. MMPM/2 offers
unlimited undo/redo operations and easy to use clipboard
controls.
MCI_AQUIREDEVICE/MCI_RELEASEDEVICE. Allows sharing of devices.
MCI_CONNECTOR command to allow access to a full-function
amp-mxier
The following MCI flags are unique to MMPM/2 and can really
maximize this 32-bit environment:
MCI_OPEN_PLAYLIST. Allows you to play memory buffers from MCI.
MCI_NOTIFY. Allows your commands to operate on a separate
thread.
MMIO (and I/O Procedures)
All MCI drivers (and therefore all MCI programs) use the
Multimedia I/O interface to communicate with the file system.
This provides the following advantages:
File format independence
Automatic format recognition
Smaller program code.
If your program will be accessing multimedia files directly, it
is recommended that you use the MMIO interface to process the
files.
Sources of Information
For information on multimedia performance and OS/2:
See the OS/2 Developer's Connection Issue #3.
See OS/2 Developer, Multimedia Special Issue (May/June 1994).
Generic multimedia overviews):
The first two OS/2 Developer's Connection CDs.
Many back issues of OS/2 Developer.
Byte --August 1993. "Under the Hood: Multimedia
Infrastructures".
Audio overview (playing from memory buffers).
See the Electronic OS/2 Developer (vol. 2, Issue 1).
See the OS/2 Developer's Connection Issue #3.
See OS/2 Developer, Multimedia Special Issue (May/June)
Software Motion Video Architecture
Dr. Dobbs Multimedia Special Editon--1993
Toolkit and Header Files
OS/2 2.1 Toolkit CD-ROM
Developer's Connection CD-ROM
C-Set++ CD-ROM
Online Help
MMPM/2 section of OS2DF1 on CompuServe
COMP.OS.OS2.MULTIMEDIA, COMP.OS.OS2.PROGRAMMER.MISC or
COMP.OS.OS2.PROGRAMMER on Internet.