Home » MODDING HQ 1.13 » v1.13 Modding, Customising, Editing » v1.13 Modding, Customising, Editing » How to connect sounds with tiles?
How to connect sounds with tiles?[message #357967] Mon, 26 August 2019 04:43 Go to next message
Kitty

 
Messages:128
Registered:October 2017
Location: Germany
I'd like to add a new openable object and give it an also new sound for opening.

I found quite a lot regarding weapon-sounds, but couldn't find anything about sounds connected with tiles. What I mean are sound like opening a crate, opening a fridge, etc.

- How does the game know, that a openable tile is a fridge and not a crate? (Being openable is "told" by jsd, but being fridge or crate apparently not)

- How does sounds.xml work? Is it "just" a list where existing sound must be filled in? Or is there more about it? Wasn't able to find information about it, any hint?


In jsd's i found animated tiles (like the rocks with floating water arround), but the openable objects are just generic/openable, no hint to anything sound-related found there.
So I assume that the definition for e.g. a fridge being a fridge and therefore play the sound for opening a fridge is stored somewhere else.
I could find the sound for opening fridge in sounds-folder and an entry in sounds.xml, but couldn't find the place where those get connected with the on-map-action of opening the fridge.
And since just putting a wav/ogg in sounds-folder and making an entry in sounds.xml won't do, I ended up in deadend.

Is this doable at all in externalized or is this hardcoded?

Thx.



I need more details.

(Didi Hallervorden)
Re: How to connect sounds with tiles?[message #357968 is a reply to message #357967] Mon, 26 August 2019 10:05 Go to previous messageGo to next message
silversurfer

 
Messages:2629
Registered:May 2009
Sounds are hardcoded in the game. You can replace a sound by replacing its sound file but you cannot add new sounds.



Wildfire Maps Mod 6.07 on SVN: https://ja2svn.mooo.com/source/ja2/branches/Wanne/JA2%201.13%20Wildfire%206.06%20-%20Maps%20MOD

Re: How to connect sounds with tiles?[message #357973 is a reply to message #357968] Tue, 27 August 2019 14:51 Go to previous messageGo to next message
Hawkeye

 
Messages:1981
Registered:October 2005
Location: Australia
Can't you add sounds with auxillary data in the JSD? I'm not at home to check at the moment, though I thought Seven added ambient sounds to some tiles, such as fire burning effects on a campfire tile, if I remember correctly.


Re: How to connect sounds with tiles?[message #357975 is a reply to message #357973] Tue, 27 August 2019 16:11 Go to previous messageGo to next message
townltu

 
Messages:385
Registered:December 2017
Location: here
Looking at the \sounds folder of an r8517 install, and comparing the 1.05 exe to the 8517 exe,
there seem to have been new tile specific sound files added to the sounds folder, like soda machine, water tap, etc
(which are btw at a wasteful high quality of 32bit & 44.1kHz o: )
and also those files names as plain txt strings appear in the 8517 exe but not in the 1.05 exe,
which indicates to me that coding is required, but it also indicates that this is basically doable.


Perhaps it is possible to add additional "blank" options to the code,
for tile specific sounds, which modders can use for their terrain tiles?

There may also be some unused sound specific entries in the exe,
and the worst workaround to replace a sound triggering original element with a new sti,jsd and wav file.
Re: How to connect sounds with tiles?[message #357985 is a reply to message #357973] Thu, 29 August 2019 19:04 Go to previous messageGo to next message
Kitty

 
Messages:128
Registered:October 2017
Location: Germany
@ Hawkeye:

You mean the SteadySectorAmbientSound by sevenFM? That's a totally cool thing and I realy, realy like it. But as far as I understand, this is a feature only available with his Improved-exe and therefore only for 7609-releases. I'll do a little dance, if this ever will be recent releases big grin
There are no nescessary entries for this in recent ini either. Simply adding hasn't worked, I tried happy
But as I remember, those new sounds had to be added in the ambienz-folder (fire) and the rest (sector sounds) in new folder "ssa". But since ambient-folder is available in standard-releases this might be working, although I don't think hearing fire was connected to tiles. I looked into montrock.sti for campfire, but couldn't see any aux-entries there.


Hm, adding sounds per aux would be cool. I sure hope you're right. To be honest, I haven't understood the whole aux-thing in jsd's complete. So far, I've found only two examples where tiles use aux-dat for animation (the floating water arround the rocks and in balime-tileset some monitors (g-decor1). All the openable doors and crates have entries in aux, but the flag for animation isn't set (just wall-orientation, nothing else set) . For all other flags (e.g. interactive) I haven't found an example at all so far. I thought maybe things like wirefences are interactive, but no flag being set there either. I guess the cutting-sound comes from the flag "wirefence" (in structure-data, not aux-data) It's rather confusing for me.

While experimenting with a new openable object, I wasn't able to connect it to "slidingdoor"-flag, even when I gave it animated frames simular to slidingdoors (used the same amount of pictures and same entries in aux). I got an error saying something about animated-tiles.cpp (cpp: Is this C++?), but it was no door, so..
But "generic,openable" (in structure-data) resulted in giving me the crate-opening sound, which is second-best, but better then no sound. I might be mistaken, but I think choosing different materials also results in different sounds sometimes, but have to do this again to verify.

I also realised that there are no different sounds for crates and fridges (as I mentioned in first post), but in sounds-folder there are two different wav. Don't know, maybe I'm just to deaf to hear the difference, too much walkman back in the days (they told me, sigh).


@ silversurfer and townItu:

Hardcoded, I kinda thought so, sigh. And since I lack the coding skills, it can't be helped.
But is there a place where I can download the code and will visualStudioCode do to open it? I'm totally aware, that I'm not capable of doing any coding, but maybe I can get glimpses of information, like what are the triggers in hardcode that result in sound a or sound b (or which lua-fact numbers I better not use, had some strange experiences therefore while adding new pc's for AR-maps, I ended up starting at number 500 in array). Or is this hopeless for someone without knowledge in C++ and one wouldn't be able to understand a thing?



I need more details.

(Didi Hallervorden)
Re: How to connect sounds with tiles?[message #357988 is a reply to message #357985] Thu, 29 August 2019 22:17 Go to previous messageGo to next message
silversurfer

 
Messages:2629
Registered:May 2009
The code can be downloaded here.

You will find sound definitions in "Utils\Sound Control.h" enum "SoundDefines". You need Visual C++ to see the numbers of each enum.
For example "SOUNDS\Fridge Door Open.wav" in Sounds.xml is number 225 which equals "OPEN_DEFAULT_OPENABLE" in "Sound Control.h".

Function "PlayJA2Sample" in "Utils\Sound Control.cpp" gets called when a sound needs to be played. There are tons of places in the code that use this function. For example when a soldier uses a wirecutter the function gets called with the parameter "USE_WIRE_CUTTERS" which is 241. If you look at entry 241 in Sounds.xml you will find "SOUNDS\wirecutters.wav".

For opening containers you can take a look at function "GetStructureOpenSound" in "TileEngine\structure.cpp". From the looks of it the sound seems to depend on the material of the container.

You see that you can't simply add sounds for interactions without changing the code.



Wildfire Maps Mod 6.07 on SVN: https://ja2svn.mooo.com/source/ja2/branches/Wanne/JA2%201.13%20Wildfire%206.06%20-%20Maps%20MOD

Re: How to connect sounds with tiles?[message #357990 is a reply to message #357988] Sat, 31 August 2019 01:45 Go to previous messageGo to next message
Kitty

 
Messages:128
Registered:October 2017
Location: Germany
@ silversurfer

Cool, thanks for the link and the explanations.

I'll see if I can make some use out of this informations. I allready thought that material is somehow connected to the sound, but it sure is better just to read which material is resulting in which sound then experimenting to find it out, saved me some time and uncertainty.
PlayJA2Sample may come in handy for some actionItems I thought about on different occations, hm. I sure tend to do too many things at once ... shy
I yet have to look into it more detailed, but it sure will help me understanding what's happening a little more. Which probably won't help me to hear the sound of the sliding-door on my object, but will ease my mind happy


@ readers as unexperienced as me

Anybody else who might be puzzled about numbers in sound.xml: The sound "Ricochet01" is sound-Nr. = 0, but since it is in line 2 (if opening with notepad++) wirecutters-sound is line 243 but sound 241. Which probably isn't anybody elses problem, but just in case...
In VisualStudioCode, hovering mouse over entry will show the right numbers.




I need more details.

(Didi Hallervorden)
Re: How to connect sounds with tiles?[message #358674 is a reply to message #357988] Wed, 18 December 2019 02:37 Go to previous messageGo to next message
Kitty

 
Messages:128
Registered:October 2017
Location: Germany
silversurfer wrote on Thu, 29 August 2019 22:17
The code can be downloaded here.

You will find sound definitions in "Utils\Sound Control.h" enum "SoundDefines". You need Visual C++ to see the numbers of each enum.
For example "SOUNDS\Fridge Door Open.wav" in Sounds.xml is number 225 which equals "OPEN_DEFAULT_OPENABLE" in "Sound Control.h".

Function "PlayJA2Sample" in "Utils\Sound Control.cpp" gets called when a sound needs to be played. There are tons of places in the code that use this function. For example when a soldier uses a wirecutter the function gets called with the parameter "USE_WIRE_CUTTERS" which is 241. If you look at entry 241 in Sounds.xml you will find "SOUNDS\wirecutters.wav".

For opening containers you can take a look at function "GetStructureOpenSound" in "TileEngine\structure.cpp". From the looks of it the sound seems to depend on the material of the container.

You see that you can't simply add sounds for interactions without changing the code.
1. I'm able to add the entries I wish for in the right places now, at least I think so. For testing if this is true, I assume the changed files must be somehow put into the JA2exe.
I have the SVN files of the recent build, so my guess would be to put the changed files into my SVN files and allow them to overwrite. And then I'm lost. Is there a way to produce an exe this way?
Or is this complete nonsense?


2. In SoundControl.cpp I've also seen a function called "PlayJA2SampleFromFile" and description says that sound added this way mustn't be in the sound array.

I was thinking about using: PlayJA2SampleFromFile( Sample.MY_SOUND, SoundVolume.MIDVOLUME, sGridNo ) in connection with an new ActionItem and use this with a Lua-ID of InteractiveAction.
Using other ActionItems this way I've allready tested.

Do I assume correctly, that with this function I won't need to enter definitions in code (since description is saying no sound-array is needed) and the soundfile just has to be in Folder "Sounds" ?
Or is this just whishful thinking and I better give up on this allready?

[Updated on: Wed, 18 December 2019 02:43]




I need more details.

(Didi Hallervorden)
Re: How to connect sounds with tiles?[message #358678 is a reply to message #358674] Thu, 19 December 2019 01:06 Go to previous messageGo to next message
silversurfer

 
Messages:2629
Registered:May 2009
I guess you can use that function to play any sound but you'd need to trigger the function at some point. I can't tell you where as I haven't worked with interactive tiles.



Wildfire Maps Mod 6.07 on SVN: https://ja2svn.mooo.com/source/ja2/branches/Wanne/JA2%201.13%20Wildfire%206.06%20-%20Maps%20MOD

Re: How to connect sounds with tiles?[message #358679 is a reply to message #358678] Thu, 19 December 2019 01:33 Go to previous messageGo to next message
Hawkeye

 
Messages:1981
Registered:October 2005
Location: Australia
Also maybe take a look at the bunker turbines from Unfinished Business they had sound with them that faded or increased depending on the proximity of the tile on screen.


Re: How to connect sounds with tiles?[message #358685 is a reply to message #358678] Fri, 20 December 2019 05:39 Go to previous messageGo to next message
Kitty

 
Messages:128
Registered:October 2017
Location: Germany
@ silversurfer:

Ok, I guess my best bet for trying to place a trigger will be ExplosionControl.lua then, at least it's worth a shot.
At least KlaxxonSound is triggered there, but that's called by array-number (214). I will give it a try.

About my question "Is there a way to produce an exe this way?" I answer myself and say that's probably called "compiling".
I followed some instruction videos and was able to implement MinGW in Visual Studio Code and my system. All the examples
the videos provided I could do. But according to the Compiling-Instructions by haydent I found in "General Development Talk",
there should be a "Projects"-Tab in Visual Studio, but my version doesn't show this tab at all. The most recent files in SVN
that I think are related to "Project" (xyz.sln) contain "2017" in the file-name, which may hints to VisualStudioExpress2017,
but this guide dates back to 2012.

Is VisualStudioExpress2017 a promissing tool for trying out the instructions and are those instructions up-to-date enough?

[Updated on: Fri, 20 December 2019 05:39]




I need more details.

(Didi Hallervorden)
Re: How to connect sounds with tiles?[message #358686 is a reply to message #358679] Fri, 20 December 2019 06:00 Go to previous messageGo to next message
Kitty

 
Messages:128
Registered:October 2017
Location: Germany
@ Hawkeye:

I found the "PowerGenFan.wav" in sounds-folder, but in code sofar only stuff that is triggered after "seeing" the fan.
Haven't yet found a hint how the sound is triggered. Couldn't find something in xml or lua of 1.13 or UB so far.
I have to double-check soundcontrol.cpp, soundcontrol.h and structure.cpp if I missed it while looking into sounds.
As far as I can tell now, this wav isn't in the sound-array of those files. Maybe it's somehow related to the sector,
but that's jsut a hunch.
Any other place I have to search aimlessly, I don't know which part of code might contain which content, so this might
take a while.
Any idea where I should look for it?

But this UB-stuff also showed interstening things about triggers for npc-records and speech-quotes and that's worth to
take a closer look later on anyhow.

[Updated on: Sun, 22 December 2019 05:41]




I need more details.

(Didi Hallervorden)
Re: How to connect sounds with tiles?[message #358690 is a reply to message #358685] Fri, 20 December 2019 10:46 Go to previous messageGo to next message
silversurfer

 
Messages:2629
Registered:May 2009
Kitty wrote on Fri, 20 December 2019 04:39
But according to the Compiling-Instructions by haydent I found in "General Development Talk",
there should be a "Projects"-Tab in Visual Studio, but my version doesn't show this tab at all. The most recent files in SVN
that I think are related to "Project" (xyz.sln) contain "2017" in the file-name, which may hints to VisualStudioExpress2017,
but this guide dates back to 2012.
The guide should still work and yes, the 2017 refers to Visual Studio 2017. I don't think it matters if you have the Express, Community (replacement for Express) or Professional edition. VS2017 may be the only version that can run the JA2 debug exe without crashing. VS2010 and VS2019 will crash because of issues with vectors in JA2 code. The release exe produced by all VS versions works however.



Wildfire Maps Mod 6.07 on SVN: https://ja2svn.mooo.com/source/ja2/branches/Wanne/JA2%201.13%20Wildfire%206.06%20-%20Maps%20MOD

Re: How to connect sounds with tiles?[message #358704 is a reply to message #358690] Sun, 22 December 2019 05:46 Go to previous messageGo to next message
Kitty

 
Messages:128
Registered:October 2017
Location: Germany
Thanks,

I got me VisualStudioExpress 2017 and VisualStudioCommunity and at first glance, I say I'll need some time to familiarize
with them, staring with which extensions I may need. That calls for tutorials and more research on my side.
But I'll give it a try, although this feels kinda out of my league shy



I need more details.

(Didi Hallervorden)
Re: How to connect sounds with tiles?[message #358706 is a reply to message #358704] Sun, 22 December 2019 11:50 Go to previous message
silversurfer

 
Messages:2629
Registered:May 2009
I hope you didn't install both, because you need either Express or Community Edition, not both. I didn't even think one could install both at the same time.



Wildfire Maps Mod 6.07 on SVN: https://ja2svn.mooo.com/source/ja2/branches/Wanne/JA2%201.13%20Wildfire%206.06%20-%20Maps%20MOD

Previous Topic: how to edit merc bio?
Next Topic: Bobby Ray's Shipment Drop Zone
Goto Forum:
  


Current Time: Thu Feb 20 12:48:20 EET 2020

Total time taken to generate the page: 0.01816 seconds