Function | Package: cg | ToC | DocOverview | CGDoc | RelNotes | FAQ | Index | PermutedIndex
| Allegro CL version 9.0 Unrevised from 8.2 to 9.0. 8.2 version

## mci-send-string

Arguments: command-string &key callback-window

Command-string should be a standard MCI command string, exactly the same as if it were passed from C or any other language using the winapi function mciSendString. Refer to the Microsoft MCI command string documentation to learn how to formulate particular strings.

If callback-window is passed (it should be a window) and the command string includes the word "notify", then when the operation has completed the mci-notify generic function will be called with the callback-window as its first argument. You may respond to these notifications by defining your own mci-notify method on your own window class, and then passing an instance of that class as the callback window to mci-send-string. The parameters of mci-notify are: ((window basic-pane) status device-id).

mci-send-string is an alternative to using various other mci functions such as mci-open and mci-play. Since each command is sent to the operating system as a literal string, mci-send-string may not be as efficient as the other mci functions, but its advantages are that (1) you can send the same standard mci strings that you would send from any other language using the winapi function mciSendString, and (2) you can presently send any MCI command this way, whereas Allegro has not yet implemented some MCI commands as individual functions.

The following example will open the "tada" wave file from the Windows media subdirectory (in win2000 it is winnt\media\), play the "da" part of the sound (starting at 140 milliseconds into the sound), and then close the wave device. Notification messages are sent arbitrarily to the debug window; since this window uses the default mci-notify method, notification messages are simply printed. Note that when we open the wave device we assign it an arbitrary alias of "yay" by which we can refer to it later.

    > (mci-send-string
         "open waveaudio!c:\\windows\\media\\tada.wav
          alias yay notify"
         :callback-window (find-window :debug-window))
    "1"

The default mci-notify method was called on :debug-window with a :success notification for MCI device 1.

    > (mci-send-string "play yay from 140 notify"
        :callback-window (find-window :debug-window))
    ""

The default mci-notify method was called on :debug-window with a :success notification for MCI device 1.

    > (mci-send-string "close yay")
    ""

See cg-mci.htm for information about MCI support in Common Graphics.

Copyright (c) 1998-2019, Franz Inc. Oakland, CA., USA. All rights reserved.
This page was not revised from the 8.2 page.
Created 2012.5.30.

|  | ToC | DocOverview | CGDoc | RelNotes | FAQ | Index | PermutedIndex
| Allegro CL version 9.0 Unrevised from 8.2 to 9.0. 8.2 version