By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
448,967 Members | 1,625 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 448,967 IT Pros & Developers. It's quick & easy.

Problem recording audio in mu-law with MCI

P: n/a
I have written a simple application that uses the MCI functions to record
audio to a file. It works fine with PCM audio (tried both
44.1kHz/16bit/stereo and 8kHz/8bit/mono). However, when I try to use
mu-law, I get a MCIERR_OUTOFRANGE error when sending the MCI_SET command.
Here is what I did:

----- start code snippet -----

MCI_WAVE_SET_PARMS wavset;
ZeroMemory(&wavset, sizeof(MCI_WAVE_SET_PARMS));

wavset.wFormatTag = WAVE_FORMAT_MULAW; // was WAVE_FORMAT_PCM
wavset.nSamplesPerSec = 8000;
wavset.wBitsPerSample = 8;
wavset.nChannels = 1;
wavset.nBlockAlign = (wavset.wBitsPerSample/8) * wavset.nChannels;
wavset.nAvgBytesPerSec = wavset.nBlockAlign * wavset.nSamplesPerSec;

DWORD dwError = mciSendCommand(wDeviceID, MCI_SET,
MCI_WAIT |
MCI_WAVE_SET_AVGBYTESPERSEC |
MCI_WAVE_SET_BITSPERSAMPLE |
MCI_WAVE_SET_BLOCKALIGN |
MCI_WAVE_SET_CHANNELS |
MCI_WAVE_SET_FORMATTAG |
MCI_WAVE_SET_SAMPLESPERSEC,
(DWORD)(LPMCI_WAVE_SET_PARMS)&wavset);

// dwError is MCIERR_OUTOFRANGE, but no error when using WAVE_FORMAT_PCM
// above.

----- end code snippet -----

Do I need to fill out other members of MCI_WAVE_SET_PARMS for non-PCM audio,
or is it simply not possible to capture audio and save it as mu-law
directly?
Regards,
Michael Lee

Nov 17 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.