mci does not recognize wav file?

Started by
1 comment, last by Adam_42 16 years, 3 months ago
Hi Everybody, I have a very strange problem with Media Control Interface. Basically I generated a bounch of .wav files with MatLab wavwrite function (sampler rate 44.1khz, 32-bit encoding,5 seconds long). However, none of the .wav files are recognized by mci (I tried simple PlaySound() function too and doesn't work). First I used mciSendString() mci would give me an error (error 296):"The specified file cannot be played on the specified MCI device. The file may be corrupt, not in the correct format, or no file handler avaliable for this format". On the other hand, all of the .wav files can be played by any other media player there is (real player, windows media player, etc...) I don't really know what's going on here. the source code is of the following #include <stdio.h> #include <iostream> #include <windows.h> #include <mmsystem.h> using namespace std; // MCI int main() { if(mciSendString("open new type waveaudio alias mysound buffer 5", NULL, 0, NULL) == 0) cout << "Driver Initialized ?" << endl; else cout << "Driver Not initialized" << endl; getchar(); DWORD Error = mciSendString("play 0.5kHz.wav from 0 to 5000",NULL, 0, NULL); char ErrorStr[256]; if(Error == 0) cout << "Succeed? ..." << endl; else { cout << "Failed..." << Error << endl; mciGetErrorString(Error,ErrorStr,256); cout << ErrorStr << endl; } getchar(); return 0; } here is the reference for wavwrite function http://www.mathworks.com/access/helpdesk/help/techdoc/index.html?/access/helpdesk/help/techdoc/ref/wavwrite.html&http://www.google.ca/search?hl=en&q=matlab+wavwrite&meta=
Advertisement
anybody?
Do other wav files work with your code, or do all of them fail with the same error?

Can you play them with PlaySound()?

I've not used mci at all, but according to: another site the command string you need is something like:

open waveaudio!c:\win95\media\chimes.wav

or

open c:\win95\media\chimes.wav type waveaudio

And yours doesn't match either pattern. Are you sure your command string is correct? Do the example ones on that site work if you put in an appropriate filename?

This topic is closed to new replies.

Advertisement