Hard Light Productions Forums

Modding, Mission Design, and Coding => FS2 Open Coding - The Source Code Project (SCP) => Test Builds => Topic started by: jg18 on October 30, 2014, 01:06:20 am

Title: Enhanced in-mission sound (128 audio channels) (Committed)
Post by: jg18 on October 30, 2014, 01:06:20 am
Here are experimental, very alpha builds with enhanced in-mission sound, using up to 128 audio channels.

Feedback is much appreciated. :) This project is part of my rehabilitation after having gone legally blind several months ago, so please be patient with me.

Missions with dense soundscapes, like the Mantis 2266 (http://scp.indiegames.us/mantis/view.php?id=2266) test mission that's attached to that issue, are where you will hear the biggest difference.

Windows

IMPORTANT: OpenAL Soft is required. Download this OpenAL32.dll file (http://www.mediafire.com/download/csdkp5psozmq2b1/OpenAL32.dll) (version 1.16.0) and put it in your FS2 folder (and also wxLauncher/\bin folder if you use wxLauncher). If you'd like to get the .dll from its original source, see the notes at the end of this post.

Download FSO builds for Windows (https://www.mediafire.com/?3ph68b7am33162a).

Linux

Linux users should be good to go for OpenAL Soft, although getting the latest version of OpenAL Soft available from your distro's repository  (or even getting the latest version from source from the OpenAL Soft website (http://kcat.strangesoft.net/openal.html)) wouldn't be a bad idea.

Patch for Linux and others interested is attached to this post.

OS X

See this thread (http://www.hard-light.net/forums/index.php?topic=89919.0) for OS X builds with OpenAL Soft.


Special thanks to niffiwan for doing some preliminary testing.



Optional notes:

To get the OpenAL Soft Windows .dll yourself, go to the OpenAL Soft website (http://kcat.strangesoft.net/openal.html), get the latest -bin.zip file (current as of writing is openal-soft-1.16.0-bin.zip), unzip the archive, rename the file bin\Wind32\soft_oal.dll to OpenAL32.dll, then copy the .dll to your FS2 folder (and wxLauncher\bin\ folder if you use wxL)

EDIT: Forgot to attach the patch.

EDIT 2: I used trunk revision 11162.

EDIT 3: Updated title to indicate work has been merged.

Title: Re: Enhanced in-mission sound (128 audio channels) (Committed)
Post by: jg18 on June 09, 2015, 02:45:15 am
:bump:

A revised version of this work was merged into master on June 1, 2015 as of commit d7f54dd. I've updated the wiki with a description, including instructions on how modders can take advantage of enhanced sound.

http://www.hard-light.net/wiki/index.php/Enhanced_sound

Enhanced sound is enabled by default if you are using OpenAL Soft. The wiki article describes how to get OpenAL Soft for anyone interested.

I am still working on OpenAL Soft support for OS X.

EDIT: Fixed title.
Title: Re: Enhanced in-mission sound (128 audio channels) (Committed)
Post by: X3N0-Life-Form on June 09, 2015, 04:38:20 am
Awesome news  :yes:
Title: Re: Enhanced in-mission sound (128 audio channels) (Committed)
Post by: jg18 on June 17, 2015, 06:36:23 pm
Thanks!

Updated OP with link to thread with OpenAL Soft test builds for OS X.
Title: Re: Enhanced in-mission sound (128 audio channels) (Committed)
Post by: Yarn on July 06, 2015, 10:19:28 pm
Does the OpenAL Soft requirement exist solely to ensure that 128 channels are available, or does the enhanced sound code utilize OpenAL Soft features that not even hardware renderers (such as some Sound Blaster cards) can provide?
Title: Re: Enhanced in-mission sound (128 audio channels) (Committed)
Post by: jg18 on July 12, 2015, 11:14:02 pm
It's primarily to ensure that 128 channels are available, although in theory, enhanced sound could make use of OpenAL soft's other features.
Title: Re: Enhanced in-mission sound (128 audio channels) (Committed)
Post by: Yarn on July 17, 2015, 08:01:28 pm
I did a quick Google search to see whether it's possible get the number of channels supported by an OpenAL renderer, and it appears that there isn't a good way of doing so--a big oversight in the design of OpenAL if you ask me. Oh well, at least OpenAL Soft works quite well.
Title: Re: Enhanced in-mission sound (128 audio channels) (Committed)
Post by: jg18 on August 07, 2015, 04:30:22 pm
Yeah, it really is unfortunate and I have no idea why they did things that way. Ah well, as you said, OpenAL Soft works pretty well at least.
Title: Re: Enhanced in-mission sound (128 audio channels) (Committed)
Post by: Spoon on May 27, 2017, 03:08:28 pm
Warning: this topic has not been posted in for at least 30 days.
Hah

As I was testing more WoD stuff today, I couldn't help but notice a lot of sound effects getting culled and everything just sounded kind of bad and quiet. So I started looking into my sound settings, then as I was doing that (and couldn't really find anything off about them), I started to vaguely remember that there had been changes to the sound code some time ago (quite some time ago it seems!). So I followed the links, dove into the wiki and boy, jg18, you have been busy. The sounds.tbl just has so much more stuff going for it. It's great!

And yeah, no **** all my sounds were barely playing, there's like 100+ sound effects that I have defined with the retail syntax, all of which gets defaulted to having a limit of 1. It's going to be some work converting this table to scp syntax, but it'll be worth it. Also, sure is nice to hear the shield impact effect play for real, instead of the old 'bzt bzt b----bzt' and also sure is nice that multiple fighters jumping at once isn't causing the most unholy of clipping anymore.


You've done some seriously great, and underappreciated work with the soundcode, jg18  :yes:
Title: Re: Enhanced in-mission sound (128 audio channels) (Committed)
Post by: jg18 on May 27, 2017, 06:00:17 pm
Thank you, Spoon. :)

Although to give credit where due:

I'm not sure who originally fixed the super-loud warp-in sound, although I remember that Iss Mneur worked on a related fix (http://scp.indiegames.us/mantis/print_bug_page.php?bug_id=2266) that I took into account when working on enhanced sound to ensure the super-loud warp-ins didn't come back.

Also, it was a new forum member who working with AdmiralRalwood figured out that hull impact sounds were broken, as you can see in this thread (http://www.hard-light.net/forums/index.php?topic=91030.0).

Finally, I don't think you should need to rewrite your sounds.tbl to use enhanced sound. I worked with m!m on making use of sounds.tbl's modularity so that you can add a sounds.tbm file (not sure exactly how to name the .tbm file, hopefully a coder who's familiar with the table parsing code would know) using SCP syntax and and specify the priorities and playback limits for WoD's gameplay sounds.

Hmm, maybe the fact that this is possible isn't clear from the wiki. :doubt:

Anyway, it's been a couple years since I worked on this code, but as I remember the syntax is something like this:

Code: [Select]
$Name: +nocreate <soundHandleName>
    +Filename: <same> (including the <>)
    +Priority: <priorityGoesHere>
    +Limit: <limitGoesHere>

The <same> tells FSO to use the same filename that is used for the sound in the underlying sounds.tbl file. That way you don't have to specify the filename again.

Example:
Code: [Select]
$Name: +nocreate 6
    +Filename: <same>
    +Priority: Medium-High
    +Limit: 5

Hope that helps.


One last thing: IIRC with hull impact sounds, FSO includes a timer to prevent multiple hull impact sounds from overlapping, in which case the concurrent playback limit doesn't make a difference with those sounds I think. We could probably make that aspect moddable so that modders could specify their own value for the timer or eliminate the timer entirely if they wanted to.
Title: Re: Enhanced in-mission sound (128 audio channels) (Committed)
Post by: AdmiralRalwood on May 27, 2017, 06:29:21 pm
One last thing: IIRC with hull impact sounds, FSO includes a timer to prevent multiple hull impact sounds from overlapping, in which case the concurrent playback limit doesn't make a difference with those sounds I think. We could probably make that aspect moddable so that modders could specify their own value for the timer or eliminate the timer entirely if they wanted to.
Well, it makes a difference if the sound is longer than the limit, which I'm pretty sure most of them are (the timer is very short, if memory serves).
Title: Re: Enhanced in-mission sound (128 audio channels) (Committed)
Post by: Spoon on May 27, 2017, 06:49:10 pm
The wiki was actually pretty clear on that part, it's just that wod already has 71 .tbl and .tbm files in its table folder, and for organizational purposes having the sounds split over two seperate files is just going to cause me headaches later (I've learned from experience). I'm a stickler for having nicely clean readable, and consolidated table files, especially the ones I have to edit often. So I bite the bullet and just spend a few hours slaving away at reorganizing my sounds.tbl (I watched the warcraft movie while doing it... it wasn't great)
But it's always good that the .tbm option is there  :yes:
Title: Re: Enhanced in-mission sound (128 audio channels) (Committed)
Post by: Spoon on May 28, 2017, 03:00:36 pm
Fun fact I just ran into. The ballistic loading sound effect (as in, when the supply ship reloads your primary ballistic weapons), is apparantly (hard?)coded to sound.tbl entry 201. I kept hearing this laser sound effect whenever a ship got rearmed and I couldn't immediately figure out how or why this was happening. All of the normal attach/detatch/reload sound entries in the table are just retail sounds and seemed to check out. Had me really bamboozled for a while.
Title: Re: Enhanced in-mission sound (128 audio channels) (Committed)
Post by: AdmiralRalwood on May 28, 2017, 05:12:34 pm
Fun fact I just ran into. The ballistic loading sound effect (as in, when the supply ship reloads your primary ballistic weapons), is apparantly (hard?)coded to sound.tbl entry 201. I kept hearing this laser sound effect whenever a ship got rearmed and I couldn't immediately figure out how or why this was happening. All of the normal attach/detatch/reload sound entries in the table are just retail sounds and seemed to check out. Had me really bamboozled for a while.
To be precise, both 200 and 201 are used for loading ballistic ammo (with 200 played at the start), just like 33 and 34 are used for loading missiles. The full list can be found on the wiki here (http://hard-light.net/wiki/index.php/Hardcoded_sounds), although since it's just straight-up copied from an earlier version of gamesnd.h, you can also just look at the source (https://github.com/scp-fs2open/fs2open.github.com/blob/master/code/gamesnd/gamesnd.h#L67).
Title: Re: Enhanced in-mission sound (128 audio channels) (Committed)
Post by: Spoon on May 28, 2017, 06:13:05 pm
Well someone might want to double check the code on that, because sound 33 and 200 are 100% not playing.
Open up m_load outside of the game and tell me if you ever even heard that sound before. (it was a first for me!)
Title: Re: Enhanced in-mission sound (128 audio channels) (Committed)
Post by: AdmiralRalwood on May 29, 2017, 02:49:18 am
Well someone might want to double check the code on that, because sound 33 and 200 are 100% not playing.
Open up m_load outside of the game and tell me if you ever even heard that sound before. (it was a first for me!)
Oh, lol, there's a logic error preventing it from playing, even though the delay before the first missile loads is based on its duration (and yes, the logic error applies to both missiles and ballistic primaries, probably due to copy&paste). I guess I'll open up a PR to fix that, and people can hear the missile loading equipment moving into position for the first time. XD
Title: Re: Enhanced in-mission sound (128 audio channels) (Committed)
Post by: Spoon on May 29, 2017, 09:49:24 am
Hah, nice, another silly bug squashed  :D