Snap! Crack! Bang! With OS/2 2.1 Multimedia Support - Part 1
OS/2 2.1 provides the richest multimedia platform of any PC-based operating system currently available. With everything from built-in System Sound support to Software Motion Video Playback, IBM has covered all the bases.
This article looks at the user interface aspect of the audio support features of OS/2's multimedia support. Look to the next issue of this Newsletter for information about the Video interface of the multimedia platform. More detailed information for software developers can be found in the OS/2 2.1 Toolkit product found on your CD-ROM.
After you install the multimedia support, a new folder appears on your desktop, Multimedia.
OS/2's audio support provides a variety of methods for including audio in your applications. Major features include System Sounds, Compact Disc, Digital Audio, and MIDI support. Let's take a closer look at each of these.
The System Sound support lets you associate sounds with a variety of system events, such as opening or closing a folder or shredding an object. Multimedia currently defines 13 system sound events (.WAV files); however, a total of 23 sound files are included with the product.
The System Sound application, included in the OS/2 System Setup folder, provides an easy method for associating a particular sound file with a system event. If you want to change one of the .WAV files associated with a system event, you simply click on the system event, such as End Drag, and then click on a new .WAV file. In addition to selecting from the different .WAV files that are shipped with OS/2, you also can create your own using the Digital Audio application. More about that later.
The System Sound application has a volume control that lets you adjust the audio level for a particular system sound or for all of the system sounds. For example, you might choose to soften the volume for things like opening and closing folders (so they don't drive you crazy!). You could also specify that other events, such as errors and warnings, have a higher volume level to get your attention.
Another very popular aspect of OS/2 multimedia support is the compact disc player. Most CD-ROM drives also play CD Digital Audio (CD-DA) discs. The Compact Disc application helps control a standard CD-ROM drive in much the same way as a home or car CD player. You will recognize some of the familiar buttons, such as PLAY, FAST FORWARD, and EJECT.
This application also has a feature known as a track calendar display. This display presents a numbered button for each of the tracks on the disc, allowing direct selection of any track. At startup, the first fourteen tracks appear. Step through the entire disc using the up and down buttons beside the calendar display.
Click the right mouse button to access a variety of features, such as the capability to edit the CD-ROM's title. As you might know, a CD-ROM is actually a digital storage device with a capacity of over 600MB. Amazingly, with over 600MB of storage, the designers of the CD-DA format didn't include the title of the disc! If you choose Edit Title from the CD-ROM Player, you can type in any title you like (up to 32 characters). The CD-ROM Player associates that title with the unique disc number in a very simple database. Now, every time you insert that disc, its title appears in the title bar of the CD-ROM Player.
The CD-ROM Player also supports a track-shuffle feature. Selecting this option causes all the tracks in the music-calendar display to be shuffled. The disc then plays in this random order, giving a whole new sound to a very familiar disc.
OS/2 with MMPM/2 installed has very powerful Digital-Audio support. With the addition of a simple audio card, you now have the ability to record, playback, and edit a wide variety of Digital-Audio sounds.
An interesting example of how you can use the OS/2 Digital-Audio subsystem is in the Digital-Audio application. This application is unusual in that it provides two personalities or views. One view is that of a Digital-Audio player and recorder. The other, slightly more complicated view, allows editing of digital audio.
In the player/recorder view, this application displays simple features, such as rewind, play, and record. Also displayed are a volume-control and media-position information. To play an existing Digital-Audio file (typically found with the .WAV extension), simply open the file and press PLAY.
If you choose to create a new audio file, simply make sure that your audio source is connected to your system, and press the RECORD button. The red RECORD button blinks, and recording continues until you press the STOP button. This action creates a temporary file containing the audio data. You, then, can specify a name and save the file, or discard it and record again.
The Editor view of the Digital-Audio application is slightly more complicated. In addition to the features described previously, a graphic representation of the Digital-Audio file can now be seen. The scale of this representation can be changed using the Zoom slider, located to the right of the View window. Moving this slider down lets you zoom in on a specific portion of the audio file.
Sections of the Digital-Audio file can now be marked by holding down the right mouse button and swiping across the view window. After you mark an area, you then can use a variety of editing functions, such as cut, copy, and paste. Specialized features, such as fade in and out, echo, reverb, and reverse are also available. And, if you don't like what you've done, discard the changes, and start over!
Musical instrument digital interface (MIDI) is a lot like a simple local area network (LAN) definition. Various electronic musical devices, such as keyboards, synthesizers, and drum machines use MIDI to communicate with one another.
For example, when you press middle C on a keyboard, a 3-byte note-on MIDI message is generated. This message contains the ID of the key pressed, as well as the velocity or speed at which the key was pressed. When the key is released, a note-off message is generated. These messages can then be interpreted by another device, such as a synthesizer to generate the actual sound of a piano note.
Thanks to this message-based design, MIDI is a very compact method for storing music content. MIDI is very popular among game developers for this reason. They can deliver a complete audio track for a game, without worrying about the great deal of storage that would be required using standard digital-audio recording.
The OS/2 support for MIDI currently is restricted to playback only. It allows use of certain digital-audio cards that can emulate MIDI synthesizers. For example, the M-Audio card from IBM, which is built around a Texas Instruments C25 Digital Signal Processor (DSP) can be used to emulate a four-voice synthesizer.
The MIDI player application lets you select any of the included MIDI files for playback.
Note: It is important to understand that MIDI implementations vary quite a bit from one audio card to another, so files that sound great on one audio card might sound a little funny on others.
This sums up the Audio Support for OS/2 Multimedia. Look in the next issue of The Developer Connection News for Video Support for OS/2 Multimedia.
Reprint Courtesy of International Business Machines Corporation, © International Business Machines Corporation