I am trying to create C++ application that takes information from a text file (mainly a csv file from excel), performs some basic math, then sorts the data, puts it into a list, to a a text file again.
What I am having problems with is the sorting the data into a list.
The detail; the text file contains information on sound files such as their title, duration (in seconds), minium total time to be played (in minutes).
So they text file looks like:
And so on...
Take 'Sound1' for example, the length of each sample is 120 seconds and the minimum time to be played is 10 minutes, so basic maths 10*60/120 gives the number of instances the song is to be played, in this case 5. For 'Sound'2 the number of instances is 12, for 'Sound3' 20, get the picture?
Heres where I having problem:
The running list I need to create is a exactly 60 minutes, with each sample played the by the minimum number of instances, but spread out equally from each other; so there will never be a period where for example Sound2 is played twice in a row.
Secondly, if the minium instances of each song has been used, and there is still time with in the 60 min, how is it possible to tell it to go back and fill the time by selecting each sound and including it till the 60 min is filled, I imagine using some sort of loop and count function, but I wouldn't know how to do it with the list.
I can include source of what I have, although it isn't much, mainly just reading from the csv file and scanning with a formatted string.
Any ideas? I'd imagine this is pretty simple if you know what you are doing.
What I am having problems with is the sorting the data into a list.
The detail; the text file contains information on sound files such as their title, duration (in seconds), minium total time to be played (in minutes).
So they text file looks like:
Code:
Sound1, 120, 10 Sound2, 30, 6 Sound3, 60, 20 Sound3, 15, 8
Take 'Sound1' for example, the length of each sample is 120 seconds and the minimum time to be played is 10 minutes, so basic maths 10*60/120 gives the number of instances the song is to be played, in this case 5. For 'Sound'2 the number of instances is 12, for 'Sound3' 20, get the picture?
Heres where I having problem:
The running list I need to create is a exactly 60 minutes, with each sample played the by the minimum number of instances, but spread out equally from each other; so there will never be a period where for example Sound2 is played twice in a row.
Secondly, if the minium instances of each song has been used, and there is still time with in the 60 min, how is it possible to tell it to go back and fill the time by selecting each sound and including it till the 60 min is filled, I imagine using some sort of loop and count function, but I wouldn't know how to do it with the list.
I can include source of what I have, although it isn't much, mainly just reading from the csv file and scanning with a formatted string.
Any ideas? I'd imagine this is pretty simple if you know what you are doing.
Comment