Ok, well I dont get any error with this, and I haad everything working till I added the menu into the mix, and as far as I can tell everything is pretty much in the right order of anyone can help me find my problem then I would be eternally grateful.
Code:
#include <iostream>
#include <windows.h>
#include <mmsystem.h>
#include <string>
using namespace std;
int main()
{
int val = 1;
do {
val = 1;
// Select file to play
string f_name = "";
string temp = "";
bool pause = false;
cout << "Type full file path if located in another folder, or type in file"
"name if locatedin same folder as the executable. Use ""!"" as the"
"terminating character e.x. \nC:\\Program Files\\LimeWire\\Korn.mp3!" << endl;
cout << "File Name: ";
getline( cin, f_name, '!' );
cin.ignore();
cout << endl;
if ( val != 0 ) {
cout << "If you want to pick a diffrent song just select RESET on menu after each song." << endl;
cout << "Or REPLAY to start the song over. or EXIT to quit the program." << endl;
cout << "Updates will probably include saved songed lists, and other helpful things." << endl;
val = 0;
}
cout << endl;
do {
pause = false;
temp = "open " + f_name;
mciSendString ( f_name.c_str(), 0, 0, 0 );
system("pause");
temp = "play " + f_name;
mciSendString ( f_name.c_str(), 0, 0, 0 );
cout << "Now Playing: " << f_name << endl;
cout << "Press Enter to display menu ( DOES NOT STOP THE SONG )" << endl;
system("pause");
cout << "1) Pause " << endl;
cout << "2) Replay" << endl;
cout << "3) Reset " << endl;
cout << "4) Exit " << endl;
cout << "Selection: ";
int tempi = 0;
cin >> tempi;
if ( tempi == 1 ) {
pause = true;
temp = "pause " + f_name;
mciSendString ( f_name.c_str(), 0, 0, 0 );
cout << "PRESS enter to Resume the song" << endl;
temp = "resume " + f_name;
mciSendString ( f_name.c_str(), 0, 0, 0 );
}
else if ( tempi == 2 ) {
temp = "close " + f_name;
mciSendString ( f_name.c_str(), 0, 0, 0 );
temp = "open " + f_name;
mciSendString ( f_name.c_str(), 0, 0, 0 );
pause = true;
}
else if ( tempi == 3 ) {
temp = "close " + f_name;
mciSendString ( f_name.c_str(), 0, 0, 0 );
pause = false;
val = 0;
}
else {
pause = false;
val =1;
}
} while ( pause == true );
} while ( val = 0 );
}