Jump to content

mciRecordAudioFile

From EDM2

This function records an audio file or MMIO compound audio file element. `mciRecordAudioFile` is a 32-bit function that is also provided as a 16-bit entry point.

The `mciRecordAudioFile` function requires a message queue and focus window.

Syntax

mciRecordAudioFile(hwndOwner, pszFile,
                   pszTitle, ulFlags)

Parameters

hwndOwner (HWND) - input
The window handle of the owner window. If this parameter is **NULL**, then the currently active window is used.
pszFile (PSZ) - input
Pointer to a multimedia file name. Compound-file names are also supported. For example:
a:\path\file+element
pszTitle (PSZ) - input
Specifies the title for the recorder window.
ulFlags (ULONG) - input
Reserved for future use and must be set to zero.

Returns

rc (ULONG) - returns
Returns **MCIERR_SUCCESS** if there was no error. An escape from the recorder dialog returns the **DID_CANCEL** return code.
  • **MCIERR_SUCCESS** If the function succeeds, 0 is returned.
  • **MCIERR_UNSUPPORTED_FLAG** *ulFlags* is not set to zero.
  • **MCIERR_MISSING_PARAMETER** No file name is sent.
  • **MCIERR_FILE_NOT_FOUND** The filename is a **NULL** string.
  • **MCIERR_OUT_OF_MEMORY** MMPM/2 could not allocate memory.
  • **DID_CANCEL** User cancelled from recording without saving recorded files, or there was an MCI error.

Remarks

The `mciRecordAudioFile` function provides a small, simple recorder window, which allows an object-oriented method of recording audio annotations. All play and record operations are from beginning to end.

This call does not return until the recorder window is closed. The message queue is processed during the operation of this function. Once the recording is completed, the window is dismissed.

This function records 11 kHz, mono, PCM audio data from the microphone input of the default waveaudio device. The sample size defaults to the card default.

This function creates the file if it doesn't exist. If a compound-file name is specified (d:\path\file+element), the file will be created. If it doesn't exist, the element will be created after the record operation completes.

The *pszFile* parameter, which specifies the name of the object to record into, is an input-only parameter.

When *pszTitle* is not specified, the last component of the file name or the MMIO element name is used.

This function records **only** digital audio files.

Example Code

#define INCL_MACHDR
#define INCL_MCIOS2
#include <os2.h>

HWND hwndOwner; /* Window handle. */
PSZ pszFile; /* Pointer to file name. */
PSZ pszTitle; /* Recorder window title. */
ULONG ulFlags; /* Reserved. */
ULONG rc; /* Return code. */

rc = mciRecordAudioFile(hwndOwner, pszFile,
            pszTitle, ulFlags);

/* The following code illustrates how to record an audio file. */

#define INCL_MCIOS2
#define INCL_MACHDR
#include <os2me.h>

ULONG rc;
HWND  hwnd;
rc=mciRecordAudioFile (hwnd, "SOUND.WAV", "TITLE", 0);

Related Functions