
A multimedia application that
integrates text and graphics with a combination of audio, motion
video, images, and animation makes your application more
attractive to the user, easier to use, and offers better mapping
to real world objects.
You can use the window
control classes and multimedia classes to implement an interface
for your application that looks like the controls of common
electronic devices, such as stereo components and video cassette
recorders (VCRs). Your application can use these controls as
interfaces to control audio and video media that is presented to
the user.
Keep in mind user
expectations when you create your user interface. Mapping your
user interface to the mental image the user has of real-world
devices greatly enhances the ease of use of your product. For
instance, most users are familiar with the play, stop, pause,
fast forward, and reverse controls of an audio cassette recorder.
To use the multimedia
classes, ensure that your working environment meets the following
requirements:
- Software
- Windows Sound System or
IBM OS/2 Version 3.0 Multimedia Presentation Manager/2
(MMPM/2) Version 1.1 is required for using the Open Class
Library multimedia classes.
- Hardware
-
A medium is a carrier
of information. A multimedia computer system is one that
is capable of input or output on more than one medium. With the
new class of computers, information in virtually any format can
be combined into multimedia presentations.
Multiple types of input allow
the user to interact with the computer in a style that best suits
the information to be communicated, thus relieving overloaded
input channels, such as a keyboard, mouse, or microphone.
Output information can be
presented in a variety of formats. Typically, output implies a
computer display, video, or audio. Video has the potential to
hold people's interest and illustrate concepts better than static
images. Audio and speech contribute a unique quality to the
multimedia system and can increase the information's content.
The Open Class Library
supports audio adapters, CD-ROM drives, video-disc players,
logical devices, amplifier-mixers, and other hardware devices as
media devices. These media devices are abstracted into classes
that contain the data and functions essential for the operation
of the real-world devices that they model.
The classes you define
for your application combine the capabilities of several classes.
Before defining the objects your application needs, choose
real-world models that the user knows how to manipulate for the
interfaces. You can then use the appropriate Open Class Library
multimedia classes that provide the corresponding functions.
The base device
classes let you create multimedia devices for your application.
The following table lists the base classes and refers to the
appropriate sections describing the multimedia devices. In
addition, these sections describe how to use the devices.
You can directly
instantiate device objects from the following classes:
Abstract Device Classes
Common functions for devices are made available through abstract
device classes. That is, abstract device classes allow
inheriting classes to reuse common functions. Note that you
cannot instantiate objects from these classes. The following
sections describe the multimedia base class and abstract device
classes. The multimedia base class (IMMDevice)
is the parent class for the family of multimedia classes,
including the base device classes and the other abstract classes.
- Device
- Purpose
- IMMPlayableDevice
- Used for many tasks, such as playing, pausing, and
seeking.
- IMMFileMedia
- Used for devices that work with files.
- IMMRecordable
- Records, saves, cuts, pastes, allows undo, allows redo,
saves-as.
- IMMRemovableMedia
- Opens and ejects media; unlocks and locks doors.
Base Functions for Multimedia
All of the multimedia device classes inherit from the
IMMDevice class. This abstract class contains all of the common
functions for device objects. These functions include the
following:
- Querying the capabilities of a device
- Opening and closing devices
- Changing the speed and time formats
- Changing the audio (on or off)
- Controlling the volume
Playable Device
Objects are usually instantiated from this class in
applications that manage different types of devices (such as a
VCR and CD remote). You do not create an actual device rather the
instantiated object is used to point to a device a user wants to
activate (such as a video player).
An object instantiated from IMMPlayableDevice is capable of
performing tasks that a home device does to play such media as
CDs or video tapes. In addition to the common device functions,
such as play, pause, and seek for devices that support playback,
IMMPlayableDevice objects are able to perform resume, stop, and
query position and length functions.
When using the multimedia
classes on the Windows operating system, for audio and video
devices you need to load the appropriate file before using any
functions on those devices. Otherwise, an exception is thrown.
This section introduces creating
audio devices that play wave and musical instrument digital
interface (MIDI) file formats.
Audio input and output is usually
in the form of wave or MIDI files.
There is a distinction between
sound and music; while it might not be distinctive to a radio, it
is to a computer. Sound, such as the sound in wave files a
Waveform Audio Player Device is basically just digitized data
that a computer cannot process. MIDI augments waveform audio by
producing sound in the multimedia environment. Your system plays
whatever is in a wave file out to your speakers. By comparison,
music is actual information. The following section introduces
basic concepts about these two formats.
MIDI is a standardized set of data
blocks or "messages" that instructs any MIDI-compatible
sound source as to which notes to play. Rather than representing
actual sound recordings, as a file of digitized audio does, a
MIDI file merely describes what notes to play and includes
settings for the sound or instrument, duration, stereo pan
position (how far left or right), and volume.
A MIDI file is comprised of
variable-length chunks. There are two types of chunks: a header
chunk and one or more track chunks. The number of chunks are
defined in the header. A MIDI event can be one of a number of
things. It can be a message that turns a particular note on or
off, that changes the voice being played by a particular channel,
or that defines something about the piece being played.
When you create multimedia
applications that play instrumental music, handle it with MIDI
(music) rather than digitized audio files (sound). The relative
size of the files involved is one of the best arguments for doing
so. Compact discs (CDs) are common and hold large amounts of
information.
Digital synthesis methods, either
FM or wavetable playback, are customarily driven by MIDI.
MIDI files have the extension .mid
and deliver more music per byte than other formats. MIDI files
are comparable in size to ASCII text files, while the other music
and sound formats (for example, wave) are comparable to color
bitmaps. A digital audio recording of a musical instrument
performance can consume large amounts of storage; a MIDI file
describing that same performance can take only a kilobyte (K) or
two. Wave and CD audio files can sometimes be too big to
distribute easily, whereas MIDI files are smaller. Compare 5
minutes of sound in a MIDI file to a 20 MB-wave file. The MIDI
file takes about 10K of storage whereas the wave file takes 20
MB. There is a noticeable difference with your application's
performance.
MIDI files do not support voice or
words. The main role for MIDI in multimedia is music composition
and production. Once the music is recorded, it can be played on a
high-end synthesizer and recorded in wave or CD-audio formats.
Waveform refers to a
digital representation of an original audio sound wave. Audio
refers to sound waves that have a perceived effect on the human
ear.
Digital recordings offer more
consistency than MIDI files. A CD recording of music sounds
virtually the same on any CD player you use, but a MIDI musical
file could sound like, for instance, a French horn on one
synthesizer and a kazoo on another. The sound depends on the
quality of the sound card. However, MIDI music typically sounds
cleaner, more realistic, and more professional than the digital
recording, especially if you do not have a sound studio to record
your tracks.
Wave files have the extension
.wav and contain analog sound that has been recorded digitally.
The pieces of sound are usually sampled sound stored as data. An analog-to-digital
converter creates sampled sound. A wave file can reproduce
sound with anything from telephone to compact disc quality in
monaural or stereo under computer control.

Controls

Creating Master
Devices
Playing Audio
Compact Discs
Creating Audio
Devices
Creating Video
Devices
Adding Animated
Buttons and Circular Sliders

IMMAudioBuffer
IMMCuePointEvent
IMMDeviceEvent
IMMNotifyEvent
IMMPassDeviceEvent
IMMPositionChangeEvent
IMMPlayerPanelHandler
IMMDeviceHandler
IMMRemovableMediaHandler
IMMAudioCDContents
IMMSpeed
IMMTime
IMMDevice
IMMAmpMixer
IMMPlayableDevice
IMMMasterAudio
IMMPlayerPanel