I wish to use mciSendString to play a basic wav file, from a point say 20 seconds from the beginning of the audio. I have tried using it to just open and play a basic wav file in the same directory as the program, however to no avail. This is the basic code I have:
int main() {
char lpszReturnString[16384];
MCI_PLAY_PARMS song = { NULL, 0, 15 };
MCIERROR open = mciSendString("open \"C:\\Users\\ethan\\source\\repos\\Project2\\Project2\\America.wav\" type waveaudio alias America", lpszReturnString, lstrlen(lpszReturnString), NULL);
MCIERROR set = mciSendString("set America time format samples", lpszReturnString, lstrlen(lpszReturnString), NULL);
MCIERROR play = mciSendString("play America from 1", lpszReturnString, lstrlen(lpszReturnString), NULL);
cout << LOWORD(open) << endl;
cout << HIWORD(open) << endl;
cout << LOWORD(set) << endl;
cout << HIWORD(set) << endl;
cout << LOWORD(play) << endl;
cout << HIWORD(play) << endl;
system("pause");
}
The output to the console is:
0
0
0
0
320
0
So I understand there is an error in the play mciSendString which translates to "MCIERR_WAVE_OUTPUTSINUSE". What does this mean and how can i fix this?