Creating an Audio-Enabled Macro for an Application

Many applications provide macro languages for extending the application's functionality. This is a possible way to integrate multimedia (usually audio) into existing applications. The basic function of an audio macro would be to record audio clips (annotations) and play them. For example, an audio clip can be associated with a location or object in a document such as a spreadsheet or worksheet.

Macros can use compound files to reduce the number of files in the system. Compound files provide a convenient way of grouping multimedia objects that are used together. The compound file structure provides for direct access to multimedia data elements.

If you were to annotate the cells of a spreadsheet and store the audio clips in a single compound file, the cell labels can be used as element names for the elements in the compound file. Then the macro can call mciRecordAudioFile and mciPlayFile to record and play back the elements of the compound file. The compound file can have the same base name as the worksheet and a file extension of .BND. This naming convention identifies which worksheet the audio files belong to. The macro does not need to keep track of cells that are moved on a worksheet, only the cell name is necessary to access the corresponding audio element of a compound file.

The audio file is created when you record or save the audio file. If you exit from a worksheet and choose not to save changes, the audio file will still exist. There is no way to recover an audio file after it is deleted (using mmioRemoveElement).

If a macro uses compound files and elements are deleted with mmioRemoveElement, the size of the compound file does not change. By specifying the MMIO_RE_COMPACT flag, a macro requests that the compound file be compacted after the element is removed. This allows audio recording into an existing wave element that can exceed the current size of the element. The resulting compound file can be compacted to save disk space.


[Back: High-Level Service API]
[Next: Creating a REXX Command File Using MCI String Commands]