I was asked to release this so
This is basically a sound streaming script that allows you to emulate music channels (brstm, aax, etc) and then play whichever, whenever. (think white world from sonic generations)
Function:
Sound tables which can be copied or renamed are in the library file (LUA_LIBR)
Some examples of usage:
-------------
Flag triggers
Boss Phase triggers
-------------
The example included uses a flag trigger that changes what layer of music plays when you enter water
I also don't suggest adding a bunch of files/musics to your projects since it does take up freeslots. Use it wisely I guess
If you have any questions feel free to ask
This is basically a sound streaming script that allows you to emulate music channels (brstm, aax, etc) and then play whichever, whenever. (think white world from sonic generations)
Function:
Code:
S_StartSoundChannel(player_t player, table{chan1}, table{chan2},
int secs, int looppoint, int channel)
[B]player[/B] = player affected
[B]table{chan1}[/B] = the defined table storing the channel1 sounds in LUA_LIBR
[B]table{chan2}[/B] = the defined table storing the channel2 sounds in LUA_LIBR
[B]secs[/B] = seconds to loop through (1*TICRATE = 1 second of files to loop through)
[B]looppoint[/B] = the number of your soundfile where the song loops
[B]channel[/B] = channel to play (0 - First | 1 - Second | 2 - Both)
Some examples of usage:
-------------
Flag triggers
Boss Phase triggers
-------------
The example included uses a flag trigger that changes what layer of music plays when you enter water
Music Files:
--------------------------
If you want to insert your own soundfiles, then you need audacity and a tiny batch file renamer that can increment numbers. (try Bulk Rename Utility)
First you need to set up your loop point in seconds (so if your song ends at 1:20 and loops at 35 seconds your loop point value will be 35. If your loop point is 35.80 then it would be 36. If the music doesn't sound right with looping you might have to edit it a bit to get it to loop properly. This will be input in the looppoint part of the function, keep it for when you use it
Run Audacity and turn off show metadata editor in options under Import/Export. After that, import the track and go to Analyze > Regular Interval Labels... and inside that dialogue, set Label Interval [seconds] to how many seconds you want to split the files into.
When audacity finishes creating labels, go to File > Export Multiple... select the sound format and export it into a separate folder. I Recommend setting file name prefix as DSEXP (replacing exp as the sound name), and using .ogg with a quality of 4 or less so the file size is low
Do these steps for for both tracks (except the looping)
--------------------------
Importing/Adding to game:
--------------------------
Import all split sounds into a new wad file (keep it organized with a marker between both sets if you need to) and save it separately as something you can recognize
Replace the content before [ //-- Length of files (# of files) ] with your own name and number of files from the tracks (not the combined total) and replace the table names, etc, with your own names for organization
Change the lines with the sfx_ prefix to your own for both tables (excluding the number extensions)
To use it in-game, just use the function wherever you want it to be used, just make sure you set the music volume to 0 or switch to a silent musiclump. (or tweak it however you want, I don't know)
--------------------------
--------------------------
If you want to insert your own soundfiles, then you need audacity and a tiny batch file renamer that can increment numbers. (try Bulk Rename Utility)
First you need to set up your loop point in seconds (so if your song ends at 1:20 and loops at 35 seconds your loop point value will be 35. If your loop point is 35.80 then it would be 36. If the music doesn't sound right with looping you might have to edit it a bit to get it to loop properly. This will be input in the looppoint part of the function, keep it for when you use it
Run Audacity and turn off show metadata editor in options under Import/Export. After that, import the track and go to Analyze > Regular Interval Labels... and inside that dialogue, set Label Interval [seconds] to how many seconds you want to split the files into.
When audacity finishes creating labels, go to File > Export Multiple... select the sound format and export it into a separate folder. I Recommend setting file name prefix as DSEXP (replacing exp as the sound name), and using .ogg with a quality of 4 or less so the file size is low
Do these steps for for both tracks (except the looping)
--------------------------
Importing/Adding to game:
--------------------------
Import all split sounds into a new wad file (keep it organized with a marker between both sets if you need to) and save it separately as something you can recognize
Replace the content before [ //-- Length of files (# of files) ] with your own name and number of files from the tracks (not the combined total) and replace the table names, etc, with your own names for organization
Change the lines with the sfx_ prefix to your own for both tables (excluding the number extensions)
To use it in-game, just use the function wherever you want it to be used, just make sure you set the music volume to 0 or switch to a silent musiclump. (or tweak it however you want, I don't know)
--------------------------
I also don't suggest adding a bunch of files/musics to your projects since it does take up freeslots. Use it wisely I guess
If you have any questions feel free to ask
Attachments
Last edited: