SAMPLE: Synchronizing Applications with CD Audio

Last reviewed: February 15, 1996
Article ID: Q103217
The information in this article applies to:
  • Microsoft Windows Software Development Kit (SDK) for Windows version 3.1

Using MCI to Synchronize a Windows-Based Application with CD Audio

Herman Rodent Microsoft Developer Network Technology Group

Created: February 10, 1993

Abstract

This technical article describes a simple technique that uses the Media Control Interface (MCI) to synchronize events in a Microsoft Windows-based application with audio from a CD. The following topics are covered:

  • MCI message interface
  • Audio CD time formats
  • Owner-draw graphical buttons
  • Extending the idea to other time sources

Four pieces of sample code included with this article create four applications: PLAYACD, a simple CD controller; SINGACD, a sing-along application that shows the lyrics to a CD as it plays; TIMEACD, an authoring tool to create the lyric files used by the sing-along application; and SINGAWAV, an application that demonstrates synchronizing to a waveform.

The SINGACD sample application shows how to use the media control interface (MCI) to synchronize an application with CD audio in Microsoft(R) Windows(TM).

SINGACD displays a moving ball above the lyrics of a song. The ball moves in time with the music and (ideally) stays above the current word in the song. Achieving this synchronization involves a two-part process: The first part involves displaying the entire line of text at the right time; the second part involves placing the ball over the correct word in the line.

SINGACD has the following components:

  • The PLAYACD application is a very simple controller for the MCI CD audio device.
  • The TIMEACD application is a tool for authoring lyric files.
  • The SINGAWAV sample is a modified version of SINGACD that opens and plays a specific wave file and lyric file.

Download SINGACD.EXE, a self-extracting file, from the Microsoft Software Library (MSL) on the following services:
  • Microsoft Download Service (MSDL)

          Dial (206) 936-6735 to connect to MSDL
          Download SINGACD.EXE (size: 260852 bytes) 
    
  • Internet (anonymous FTP)

          ftp ftp.microsoft.com
          Change to the \SOFTLIB\MSLFILES directory
          Get SINGACD.EXE (size: 260852 bytes) 
    


Additional reference words: 3.10 softlib SINGACD.EXE
KBCategory: kbmm kbprg kbfile
KBSubcategory: MMCDROM


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: February 15, 1996
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.