SRB2 Message Board  

Go Back   SRB2 Message Board > Archived > Outdated Releases (2.1.X) > Lua (2.1.X)

 
 
Thread Tools
Sound Channels (Music Layers) Details »»
Sound Channels (Music Layers)
Version: 1.0.1, by Varren (local furry) Varren is offline
Developer Last Online: Dec 2020

Category: Version: SRB2 Rating: (1 votes - 3.40 average)
Released: 05-04-2015 Last Update: Never Favourites: 0
Scripts Re-Useable Content

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:
Code:
S_StartSoundChannel(player_t player, table{chan1}, table{chan2}, 
int secs, int looppoint, int channel)

player = player affected
table{chan1} = the defined table storing the channel1 sounds in LUA_LIBR
table{chan2} = the defined table storing the channel2 sounds in LUA_LIBR
secs = seconds to loop through (1*TICRATE = 1 second of files to loop through)
looppoint = the number of your soundfile where the song loops
channel = channel to play (0 - First | 1 - Second | 2 - Both)
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

Spoiler: DIY Guide

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)
--------------------------





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

Download Now

File Type: zip lua_soundchannels.zip (2.84 MB, 336 views)

Show Your Support

  • The author of this addon has given explicit permission for its content to be re-used and/or reproduced.

Comments
Old 05-04-2015   #2
Boinciel
ヒトデパンと奇妙なジャム
Administrator
 
Boinciel's Avatar
Default

Barring a few bugs like the audible gaps between the segments in the example wad, this is pretty neat. With this, we can finally have the Phantasy Star Online soundtrack as it was intended to be used!
Boinciel is offline  
Old 05-04-2015   #3
Varren
local furry
Developer
 
Varren's Avatar
Default

Quote:
Originally Posted by Boinciel View Post
Barring a few bugs like the audible gaps between the segments in the example wad ...
Sorry about that...
This was literally not an issue before I converted it into a function, and I'm not sure why it does this (rarely)

EDIT: It looks like this is an issue with the sdl2(?) version. It works fine with srb2dd for me
__________________
Quote:
"I thought her special gift was spinning really fast to collect gold rings"

Last edited by Varren; 05-05-2015 at 05:42 AM.
Varren is offline  
 

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 07:34 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2020, vBulletin Solutions, Inc.