question about a program

i want to create a program (in c++ or c#) that will play mp3 files but also display a word file with the lyrics of the mp3 song playing. so if i choose a mp3 file from a list, the lyric file for that song should also be displayed. i have all the mp3 and lyric files saved on the computer so my problem is how can i link the files?

i would really appreciate any suggestions
thanks
There are tons of ways you can do this. The easiest way I can think of right now would be to give everyone mp3 file a number to tell the program which mp3 file is which. Since to the program they are all just mp3 files. You could think of it as a ID number. If you don't know what an ID number is feel free to ask. Also give each lyric file an ID number as well for the same reason as the mp3 files. Once you have that done all you have to say is When mp3 ID 2443 is called to play, also open up lyric file 34253.

if i gave all the files an ID would i have to write code for every mp3 file to find the correct lyric file? there could be over 100 files and i want to be able to add more files in the future. what if the mp3 and the lyric files had the same name? so if i choose a mp3 file the program will search though the list of lyric files, find the one with the same name and open it
Last edited on
You can if you want :P. Or you can use an enumerator plus an increment ( which is just ex. i=i+1 or you can write it i++ which means the same thing) to just add ID numbers to each mp3 and lyric file. The only thing is reading all the files names from a folder on your computer isn't something that you can do in c++. So if your on a windows computer you will have to look into how to use some windows functions to get it done. be careful though people like to tell you how you should do it the super complicated way because that is the "right way" you don't have to. As long as the program you created does what you want when you want you don't need to used any deep windows functions which would have you end up learning tons about windows programming.
You might be able to just use the Conio.h header to get it done.

You are also going to have to think what is going to be the limit of how many mp3 that you have. or will the person using your program type in the limit.

well i actually have a previous program i created in c# that's like a simple version of itunes. so i guess i could modify this program. I just want a simple way of linking the mp3 and lyric files
Here is a simple example for the ID. This is written in c++ though.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#include <string>

using std::string;

#define N_MP3 200
#define N_LYRIC 200

struct MP3_FILE 
{

    string SongName;
     int Song_ID;
     string LyricName;
     int Lyric_ID;

}songs[N_MP3];

int main ()
{
     for (int n=0; n<=N_MP3; n++)
       {
           string mp3name;
          /* find a file name from the folder  and assign mp3name */
   
           song [n].SongName=mp3name;
      }

      return 0;
}


You can do the same for both mp3 and lyric names and just add ID numbers to each name or you can do both at the same time.

I didn't add the enum to it but I'll leave it for you to play around with :P
Last edited on
Topic archived. No new replies allowed.