I am making a music player, and I decided to use mciSendString(), and it worked just fine!
The issue is:
If the song I want to play has cover art, no music plays. If I manually remove the cover art using something like MP3tag, it then plays fine.
song = playlist.get(songnum); //this changes song which is a value holding a path from the old song to the path of the new song
command = mcicommand(song, "c", volume); //send back the new path to the function command to make us the new command to use in mcisend string
mciSendString(command.c_str(), NULL, 0, NULL);
string mcicommand(string path, string voc, string volume) {
if (voc == "c") { //Play Command
string command = "open type mpegvideo alias song"; //the template for the open command we will use
int found = command.find(" "); //finds the first space in the template
command = command.substr(0, found) + " \"" + path + "\"" + command.substr(found); //adds the stuff before the first space then the path after the first space then second space then everything after that second space
return command; //returns the command which we will use in mcisend string
}
if (voc == "v") { //Volume command
string command = "setaudio song volume to "; //same as the one before just with a different command string
int found = command.find_last_of(" ");
command = command.substr(0, found) + " " + volume;
return command;
}
}
So far, I used FFmpeg to read the info of the music files, and found out that the cover art is sort of defined as a track? So my assumption is that mciSendString() is trying to play the cover art instead of the actual audio track?
I cannot really decipher the documentations to understand how I can fix this.
Extra Info
Song that didn't played noise:
Input #0, mp3, from 'Golden.mp3':
Metadata:
: major_brand
encoder : Lavf57.56.101
Duration: 00:01:54.08, start: 0.011995, bitrate: 138 kb/s
Stream #0:0: Audio: mp3, 44100 Hz, stereo, fltp, 128 kb/s
Metadata:
encoder : Lavc57.64
Stream #0:1: Video: png, rgb24(pc), 400x225, 90k tbr, 90k tbn (attached pic)
Metadata:
title : attached picture
comment : Cover (front)
Song that played noise:
Input #0, mp3, from 'HeatAFire.mp3':
Metadata:
major_brand : mp42
minor_version : 0
compatible_brands: isommp42
encoder : Lavf58.29.100
Duration: 00:03:59.05, start: 0.025057, bitrate: 128 kb/s
Stream #0:0: Audio: mp3, 44100 Hz, stereo, fltp, 128 kb/s
Metadata:
encoder : Lavc58.54