本文整理汇总了C++中Playlist::readPlaylist方法的典型用法代码示例。如果您正苦于以下问题:C++ Playlist::readPlaylist方法的具体用法?C++ Playlist::readPlaylist怎么用?C++ Playlist::readPlaylist使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Playlist
的用法示例。
在下文中一共展示了Playlist::readPlaylist方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
void main(void)
{
Playlist playlistObj;
vector <string> musicVector;
unsigned char key;
bool exitProgram = false;
string fileName;
string musicPath;
unsigned musicCounter = 0;
musicVector.push_back("sample_song");
while (exitProgram == false)
{
cout << "Welcome to the Simple Audio Player" << endl;
cout << "Experimental Version 1.0" << endl << endl;
//will play sounds store on the vector
wstring song = wstring(musicVector.at(musicCounter).begin(), musicVector.at(musicCounter).end());
cout << "Now Playing: " << musicVector.at(musicCounter).c_str() << endl;
PlaySound( song.c_str() , NULL, SND_ASYNC | SND_LOOP);
//Receives user input for next action
cin >> key;
switch (key)
{
case 'q':
case 'Q': //exits program
exitProgram = true;
break;
case 'r':
case 'R': //reads playlist file
cout << "Enter playlist file name" << endl;
cin >> fileName;
musicVector = playlistObj.readPlaylist(fileName);
musicCounter = 0; //resets to the start of the playlist
break;
case 'n': //next on playlist
case 'N':
if ((musicCounter + 1) >= musicVector.size() )
musicCounter = 0;
else
musicCounter++;
break;
case 'b': //next on playlist
case 'B':
if ((musicCounter - 1) <= 0 )
musicCounter = musicVector.size() - 1;
else
musicCounter--;
break;
default:
cout << "Please enter a valid option" << endl;
break;
}
system("CLS");
}
}