First off, lets recap what we know:
Each trigger cycle == (1/11.9) seconds, so in 1 cycles thats 0.084 seconds.
So, lets say you have a song which last 10 seconds.
Step 1:calculate 10*11.9 = 119.
This is the total number of trigger cycles you will need for this song.
Step 2:Lets say you want to split this song into 3 wavs.
calculate 119 / 3 = 39.6666...
Step 3:Using the 39.66... from before as guidance, split 119 into the following:
119 = 40 + 40 + 39.
Step 4:Calculate the length each wav needs to be:
Since 1 cycle is (1/11.9) seconds, we get the following
Length of segment 1 = 40/11.9 = 3.36134 seconds
Length of segment 2 = 40/11.9 = 3.36134 seconds
Length of segment 3 = 39/11.9 = 3.27731 seconds
Thus we have the following:
segment 1 = time from 0 seconds to 3.36134 seconds
segment 2 = time from 3.36134 seconds to 6.722689 seconds
segment 3 = time from 6.722689 seconds to 10 seconds
You will need 6 wavs for each song:
wav 1 == segment 1 of song - This has length 3.36134 seconds and corresponds to 40 trigger cycles.
wav 2 == segment 2 of song - This has length 3.36134 seconds and corresponds to 40 trigger cycles.
wav 3 == segment 3 of song - This has length 3.27731 seconds and corresponds to 39 trigger cycles.
wav 4 == fade-out during seg. 1 of song - This has length 3.36134 seconds and corresponds to 40 trigger cycles.
wav 5 == fade-out during seg. 2 of song - This has length 3.36134 seconds and corresponds to 40 trigger cycles.
wav 6 == fade-out during seg. 3 of song - This has length 3.27731 seconds and corresponds to 39 trigger cycles.
Here's the important bit - You need these three deathcounters:DC1 == holds what song is being played
DC2 == holds song timer
DC3 == holds what song is up next
The triggers would be like this:
//This subtracts from DC2 always, ofc.
if(
DC2 is at least 1
)
then(
Subtract 1 from DC2
)
//This is needed up here, and allows player to start playing song 1 after they have finished fading out whatever song was playing before.
if(
DC1 is exactly -number corresponding to "Currently Fading out Last Song"-
DC2 is exactly 0
DC3 is exactly -number corresponding to song 1-
)
then(
DC1 set to -number corresponding to song 1-
DC3 set to 0
)
//This just plays the song 1 is there is no song up next.
if(
DC1 is exactly -number corresponding to song 1-
DC2 is exactly 0
DC3 is exactly 0
)
then(
play seg1 of song1
DC2 set to 119
)
if(
DC1 is exactly -number corresponding to song 1-
DC2 is exactly 79 //This is 119 - 40, since 119 == length of song, 40 == length of first segment of song
DC3 is exactly 0
)
then(
play seg2 of song1
)
if(
DC1 is exactly -number corresponding to song 1-
DC2 is exactly 39 //This comes from 39 = 119 - 40 - 40
DC3 is exactly 0
)
then(
play seg3 of song1
)
//This lets you transition from song 1 to other songs
if(
DC1 is exactly -number corresponding to song 1-
DC2 is exactly 0
DC3 is at least 1
)
then(
play fadeout-seg1 of song1
DC1 set to -number corresponding to "Currently Fading out Last Song"-
DC2 set to 39 //This to the length of the last song cycle
)
if(
DC1 is exactly -number corresponding to song 1-
DC2 is exactly 79
DC3 is at least 1
)
then(
play fadeout-seg2 of song1
DC1 set to -number corresponding to "Currently Fading out Last Song"-
DC2 set to 39
)
if(
DC1 is exactly -number corresponding to "Currently Fading out Last Song"-
DC2 is exactly 39
DC3 is at least 1
)
then(
play fadeout-seg3 of song1
DC1 set to -number corresponding to "Currently Fading out Last Song"-
DC2 set to 39
)
Now just copy-paste the 'song1' triggers for other songs.
Edit: Actually now that I think about it, this would work fine if you had a bunch of different songs with different lengths, assuming you take care of making sure the wav lengths correspond correctly to the number of cycles they run for.
IMPORTANT EDIT: I went through and fixed all of the terribly inaccurate numbers I had for the amounts of DC2. They are correct now.
Post has been edited 8 time(s), last time on Mar 10 2017, 9:38 pm by Zoan.