hello all i got a problem.
i learned from a tutorial and at the end i download the tutorial files.
the tutorial is about playing mp3 with MCI.
the problem is... i have no idea how to enter the name of the music file.
i'll show u the code... there are 2 files the header and the main file.
main file:
/////////////////////////////////////////////////////////
// Author: Rob Zimmerman
// Description: This simple console-based example shows
// the steps needed to play an MP3 file using the
// CMP3_MCI class.
/////////////////////////////////////////////////////////
#include <conio.h>
#include "CMP3_MCI.h"
int main(char* argv[])
{
CMP3_MCI MyMP3;
char cUserSelection = 0;
MyMP3.Load(argv[1]);
while(cUserSelection != '4')
{
system("cls");
printf("Console MP3 Player\n");
printf("1) Play\n");
printf("2) Stop\n");
printf("3) Pause\n");
printf("4) Exit\n");
printf("Enter Your Selection: ");
cUserSelection = getch();
switch(cUserSelection)
{
case '1':
MyMP3.Play();
break;
case '2':
MyMP3.Stop();
break;
case '3':
MyMP3.Pause();
break;
}
}
return 0;
}
and the header file
/////////////////////////////////////////////////////////
// Author: Rob Zimmerman
// Description: This header file implements a class that
// will manage a single MP3 file. Simply load the file,
// the start playing it!
//
// Usage: Feel free to modify this file however you like.
// Drop me a line at rzimmerm@23rdhour.com if you
// use this in any way just so I can see what it's
// being used for. No charge of course ;)
/////////////////////////////////////////////////////////
#ifndef _MP3_USING_MCI
#define _MP3_USING_MCI
#include <string>
#include <windows.h>
#include <mmsystem.h>
class CMP3_MCI
{
public:
CMP3_MCI(){m_bPaused = false;}
~CMP3_MCI(){Unload();}
inline void Load(char *szFileName)
{
m_szFileName = szFileName;
Load();
}
inline void Load(std::string szFileName)
{
m_szFileName = szFileName;
Load();
}
inline void Play()
{
std::string szCommand = "play " + GetFileName() + " from 0";
mciSendString(szCommand.c_str(), NULL, 0, 0);
}
inline void Stop()
{
std::string szCommand = "stop " + GetFileName();
mciSendString(szCommand.c_str(), NULL, 0, 0);
}
inline void Pause()
{
std::string szCommand;
if(IsPaused())
{
szCommand = "resume " + GetFileName();
mciSendString(szCommand.c_str(), NULL, 0, 0);
SetPaused(false);
}
else
{
szCommand = "pause " + GetFileName();
mciSendString(szCommand.c_str(), NULL, 0, 0);
SetPaused(true);
}
}
inline void Unload()
{
std::string szCommand = "close" + GetFileName();
Stop();
mciSendString(szCommand.c_str(), NULL, 0, 0);
}
//Accessor's for private members.
inline std::string GetFileName()
{return m_szFileName;}
inline bool IsPaused()
{return m_bPaused;}
inline void SetPaused(bool bPaused)
{m_bPaused = bPaused;}
private:
inline void Load()
{
std::string szCommand = "open \"" + GetFileName() + "\" type mpegvideo alias " + GetFileName();
mciSendString(szCommand.c_str(), NULL, 0, 0);
}
std::string m_szFileName;
bool m_bPaused;
};
#endif
where can i enter the name of file?? i saw main take it as parameters but how i enter it?
thanks in advance
[Edited by - mc30900 on July 2, 2006 3:48:56 PM]