Click here to Skip to main content
15,886,362 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Visual C++ 2022 cout bug? Pin
Shao Voon Wong12-May-23 2:01
mvaShao Voon Wong12-May-23 2:01 
GeneralRe: Visual C++ 2022 cout bug? Pin
Richard MacCutchan12-May-23 2:09
mveRichard MacCutchan12-May-23 2:09 
GeneralRe: Visual C++ 2022 cout bug? Pin
Shao Voon Wong12-May-23 2:15
mvaShao Voon Wong12-May-23 2:15 
GeneralRe: Visual C++ 2022 cout bug? Pin
Richard MacCutchan12-May-23 3:10
mveRichard MacCutchan12-May-23 3:10 
GeneralRe: Visual C++ 2022 cout bug? Pin
jschell12-May-23 9:56
jschell12-May-23 9:56 
GeneralRe: Visual C++ 2022 cout bug? Pin
Richard MacCutchan12-May-23 22:24
mveRichard MacCutchan12-May-23 22:24 
GeneralRe: Visual C++ 2022 cout bug? Pin
Shao Voon Wong12-May-23 2:03
mvaShao Voon Wong12-May-23 2:03 
QuestionPlaying an mp3 file using MCI Pin
Derell Licht11-May-23 10:34
professionalDerell Licht11-May-23 10:34 
I am trying to play an mp3 file from a WinAPI/C++ application. I'm using 32-bit MinGW on Windows 10.
I found an example program which uses the MCI (winmm) interface to play the file; I found an example command-line program which implements this using mciSendString() calls...

I had some problems handling paths to the mp3 file, and *thought* I had fixed it by converting the paths to 8.3 short format... the command-line program plays the files just fine, but when I import exactly the same code into my WinAPI dialog-box application, although the MCI functions all return success, no sound plays...

Does anyone have any idea what is missing here?? Or does this library just not work from a Windows dialog app?

Here's the code:

{
static char short_str[MAX_WAVE_FILE_LEN+1] = "" ;
CMP3_MCI MyMP3;
int result = GetShortPathName (wave_name, short_str, MAX_WAVE_FILE_LEN);
syslog("short: %d: [%s]\n", result, short_str);
DWORD lerror = MyMP3.Load(short_str);
DWORD serror = MyMP3.Play();
syslog("MCI: Load: %08X, Play: %08X\n", lerror, serror);
}

And here are the load and play functions from his MCI class:

inline MCIERROR Load()
{
   std::string szCommand = "open \"" + GetFileName() + "\" type mpegvideo alias " + GetFileName();
   return mciSendString(szCommand.c_str(), NULL, 0, 0);
}

inline MCIERROR Load(char *szFileName)
{
   m_szFileName = szFileName;
   return Load();
}

inline MCIERROR Play()
{
   std::string szCommand = "play " + GetFileName() + " from 0";
   return mciSendString(szCommand.c_str(), NULL, 0, 0);
}

AnswerYou might as well use DirectShow to play MP3 and AAC. Pin
Shao Voon Wong11-May-23 15:55
mvaShao Voon Wong11-May-23 15:55 
AnswerRe: Playing an mp3 file using MCI Pin
Derell Licht12-May-23 9:10
professionalDerell Licht12-May-23 9:10 
QuestionMessage Closed Pin
10-May-23 8:07
Member 1496877110-May-23 8:07 
AnswerRe: another "everybody knows that " question on C++ : Preserved for posterity Pin
k505410-May-23 8:43
mvek505410-May-23 8:43 
AnswerRe: another "everybody knows that " question on C++ Pin
k505410-May-23 9:05
mvek505410-May-23 9:05 
GeneralMessage Closed Pin
10-May-23 9:54
Member 1496877110-May-23 9:54 
GeneralRe: another "everybody knows that " question on C++ Pin
k505410-May-23 10:31
mvek505410-May-23 10:31 
GeneralRe: another "everybody knows that " question on C++ Pin
jschell11-May-23 4:57
jschell11-May-23 4:57 
GeneralRe: another "everybody knows that " question on C++ Pin
harold aptroot10-May-23 10:39
harold aptroot10-May-23 10:39 
GeneralMessage Closed Pin
10-May-23 11:26
Member 1496877110-May-23 11:26 
GeneralRe: another "everybody knows that " question on C++ Pin
Richard MacCutchan10-May-23 21:46
mveRichard MacCutchan10-May-23 21:46 
AnswerRe: another "everybody knows that " question on C++ Pin
jschell11-May-23 5:10
jschell11-May-23 5:10 
GeneralMessage Closed Pin
11-May-23 6:32
Member 1496877111-May-23 6:32 
GeneralRe: another "everybody knows that " question on C++ Pin
Richard MacCutchan11-May-23 9:05
mveRichard MacCutchan11-May-23 9:05 
RantMessage Closed Pin
12-May-23 9:35
Member 1496877112-May-23 9:35 
GeneralRe: another "everybody knows that " question on C++ Pin
OriginalGriff12-May-23 23:32
mveOriginalGriff12-May-23 23:32 
GeneralRe: another "everybody knows that " question on C++ Pin
jschell12-May-23 9:36
jschell12-May-23 9:36 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.