Fortune! finally it works with wave files. (the end range 10000 was to high for my testwaves).
But mp3 files wont play.
I use W2k and have the "Frauenhofer IIS MPEG Laver3-Codec (advanced) 1.9 build305" installed and working.
I thought i could play any multimedia files when the propriate codecs are available.
Main Topics
Browse All Topics





by: NickRepinPosted on 2001-01-25 at 03:51:51ID: 183519
Your code works perfectly on my NT, at least, it plays WAV files. But with getch() statement only, see below, i.e. the application must be running to allow MCI to play the file.
Of course, to play mp3, your system must have an appropriate codec installed.
#include <windows.h>
#include <stdio.h>
#include <conio.h>
void main()
{
LPCSTR filename="aaa.wav";
char command[1024];
sprintf(command,"open %s type waveaudio alias mp3",filename);
mciSendString(command,0, 0, 0);
mciSendString("set mp3 time format samples", 0, 0, 0);
mciSendString("play mp3 from 1 to 10000", 0, 0, NULL);
getch();
}