Hard Light Productions Forums

Modding, Mission Design, and Coding => FS2 Open Coding - The Source Code Project (SCP) => Topic started by: TrashMan on December 30, 2017, 05:13:52 am

Title: Sound modularity (departure from sounds.tbl)
Post by: TrashMan on December 30, 2017, 05:13:52 am
Most things in SCP are highly modular.

I can make a ship and supply a -shp.tbm file and anyone can just drag and drop it (+ models and maps) into any active mod and it will work.
If it uses custom weapons, make a -wpn.tbm and drop hat in and it will work.
Custom weapon effects? Supply them, drag and drop!

But not with sounds. Sounds are cumbersome, since you constantly have to reference the numerical ID instead of actual file names AND because you have a singular file that is not conductive to multiple mods.

I suggests that one can reference sounds directly by name as well as by sounds.tbl ID (for backwards compability).

For example, I can say
$LaunchSnd:                             93

OR

$LaunchSnd:       "trp_photon_muzzle.wav"


This not only makes the entire system more modular, but also makes modding easier, since you don't have to do cross-references with the sounds.tbl, and is easier to read a a glance.
Title: Re: Sound modularity (departure from sounds.tbl)
Post by: m!m on December 30, 2017, 05:27:49 am
Everything you described is already possible :nervous:

The wiki article (http://wiki.hard-light.net/index.php/Sounds.tbl) has documentation for all the features but if you use one of the two new sound entry formats you can assign an arbitrary name to a sound entry and then reference the sound with that name. The reason you can't just put the file name in the tables is that the file name alone is not enough information for a full sound entry.
Title: Re: Sound modularity (departure from sounds.tbl)
Post by: TrashMan on December 30, 2017, 08:05:41 am
Everything you described is already possible :nervous:

The wiki article (http://wiki.hard-light.net/index.php/Sounds.tbl) has documentation for all the features but if you use one of the two new sound entry formats you can assign an arbitrary name to a sound entry and then reference the sound with that name. The reason you can't just put the file name in the tables is that the file name alone is not enough information for a full sound entry.

So?
Set other values to defaults.
Title: Re: Sound modularity (departure from sounds.tbl)
Post by: m!m on December 30, 2017, 08:52:25 am
In most cases there are no "default" values. For example, some times you need a 3D sound and some times you need a 2D sound. In your example which uses $LaunchSnd a 3D sound would be appropriate but in the case of a HUD sound a 2D sound is needed (which can then contain stereo sound). FSO cannot determine at the point at which the sound file name is parsed if the sound should be a 2D or 3D sound except if a preference would be hard-coded into the parser code and I am strongly opposed to that since it would require a lot of work for practically no benefit.
Title: Re: Sound modularity (departure from sounds.tbl)
Post by: TrashMan on December 30, 2017, 01:52:18 pm
Then add that value in too

$LaunchSnd:       "trp_photon_muzzle.wav"
+3DSound:          YES
Title: Re: Sound modularity (departure from sounds.tbl)
Post by: The E on December 30, 2017, 02:47:36 pm
And then, once we're done adding all the fields that are required to properly set up a sound effect for the engine to use, we arrive at something that is indistinguishable from the current format.

Seriously, do you think we would be asking for all that information if we didn't need to?
Title: Re: Sound modularity (departure from sounds.tbl)
Post by: TrashMan on December 30, 2017, 06:10:24 pm
It's two.

I can't even recall the last time anyone changed the other values (0, 1.00, 2, 500, 1000). This would be most useful for weapons anyway.
Title: Re: Sound modularity (departure from sounds.tbl)
Post by: TrashMan on December 31, 2017, 03:52:20 am
Actually, thinking about it there may be an even better way.

The ID and file names are both unique - after all, you can' have two files with the exact same name in the sounds folder.

so if you put:

Code: [Select]
$LaunchSnd:                             93
OR
$LaunchSnd:       "trp_photon_muzzle.wav"

the game could check the sounds.bl for EITHER

$Name:   209   trp_photon_muzzle.wav,   0, 1.00, 2, 500, 1000

And effectively return the ID for that filename.

That means that even if different sounds.tbl have different number of entries and different ID's for the same sound, the game will always return the right ID without the modders having to worry about it.



Title: Re: Sound modularity (departure from sounds.tbl)
Post by: m!m on December 31, 2017, 03:56:56 am
The file name is not unique since two sound entries can use the same sound file with different values.
Title: Re: Sound modularity (departure from sounds.tbl)
Post by: AdmiralRalwood on December 31, 2017, 05:18:30 pm
I don't understand why you aren't just giving your sounds names and calling it a day.
Title: Re: Sound modularity (departure from sounds.tbl)
Post by: TrashMan on January 06, 2018, 01:32:21 pm
I don't understand why you aren't just giving your sounds names and calling it a day.

Because it's still not modular.

.tbm's allow of merging of different ship and weapons, bu sounds are still all in one file.
Title: Re: Sound modularity (departure from sounds.tbl)
Post by: Axem on January 06, 2018, 01:43:15 pm
Quote
This table is one of the Modular Tables and can be extended with xxx-snd.tbm

Not anymore. (http://wiki.hard-light.net/index.php/Sounds.tbl) :)