Crowdedlight / Crows-Electronic-Warfare

Arma 3 Mod that enables electronic warfare features such as Radio/Drone jamming and spectrum signal tracking
https://crowdedlight.github.io/Crows-Electronic-Warfare/
Other
19 stars 7 forks source link

Add preview of selected sounds for Zeus #50

Closed Landric closed 7 months ago

Landric commented 10 months ago

Zeus gets a preview of the selected sound for "Add Sound" and "Play Sound" modules

Crowdedlight commented 10 months ago

Would it be possible to also use stopSound to stop played sounds with the addSound module when its deleted? So if unit is removed, killed or "remove sound" module is used on it?

Currently there is the issue of longer sounds that has been started like air sirene will continue until it ends, even if removed. Would be neat to have zeus able to stop longer sounds instantly by deletion.

Landric commented 10 months ago

I don't see why not! The ID of the created sound would need to be stored somewhere - probably as a variable on the object the module is used on. (Would need to account for the possibility of multiple sounds being added to one object?)

Something similar could be done for playSound if it creates a logic entity to play from - although that's probably lower priority unless really massively long sound files are added!

I can take a look at that and bundle it into this PR

Crowdedlight commented 10 months ago

I don't see why not! The ID of the created sound would need to be stored somewhere - probably as a variable on the object the module is used on. (Would need to account for the possibility of multiple sounds being added to one object?)

Something similar could be done for playSound if it creates a logic entity to play from - although that's probably lower priority unless really massively long sound files are added!

I can take a look at that and bundle it into this PR

That would be amazing if you had time to add that! I think you could probably use a list with sounds set on the specific unit. As I recall you don't need to broadcast it over network, because all clients get the events for adding or removing sounds.

I'll go through and review the current PRs one of the coming days when my brain is not fried from work 😅

Landric commented 10 months ago

I'll go through and review the current PRs one of the coming days when my brain is not fried from work 😅

Absolutely, no rush at all!

Landric commented 10 months ago

Noticed a bug while testing this - for some reason the Air Raid siren doesn't always play through Add Sound (although Play Sound works fine).

To reproduce:

Not all sounds seem to be affected by this (e.g. "Cathedral Bells (20s)" works reliably)

Bug also seems intermittent - sounds will start working after some (unknown) combination of applications of Add Sound and Play Sound.

Not sure if this is something I introduced in an above commit. Seems to be present in the main branch too.

Landric commented 10 months ago

Added a (partial) implementation of stopping sounds played with Play Sound - creates a logic object that holds the sound ID (as well as visualising the sound source & display name).

If the logic object is deleted, the sounds are stopped. (Need to test this on the server). Logic object decays automatically once the sound ends.

Currently only able to stop sounds in-progress when Play Sound is used with no targets.

Crowdedlight commented 8 months ago

Noticed a bug while testing this - for some reason the Air Raid siren doesn't always play through Add Sound (although Play Sound works fine).

To reproduce:

* Place a "Loudspeakers" object

* Apply `Add Sound` module to object, and select "Air Raid Siren (2.5min)"

* Sound does not appear to play

Not all sounds seem to be affected by this (e.g. "Cathedral Bells (20s)" works reliably)

Bug also seems intermittent - sounds will start working after some (unknown) combination of applications of Add Sound and Play Sound.

~Not sure if this is something I introduced in an above commit.~ Seems to be present in the main branch too.

Is this still an issue we should diagnose and try to find? I have not experienced it before, but haven't specifically looked for it either.

Landric commented 8 months ago

Is this still an issue...

Confirmed, reproduced locally and on DWR server

...we should diagnose and try to find?

eh, probably, although its likely not high-impact. When I get time, I'll try and do some more thorough testing for what combination of objects/sounds are affected.

Crowdedlight commented 8 months ago

Is this still an issue...

Confirmed, reproduced locally and on DWR server

...we should diagnose and try to find?

eh, probably, although its likely not high-impact. When I get time, I'll try and do some more thorough testing for what combination of objects/sounds are affected.

Roger. That would be lovely if you had an idea where to look. I don't see any obvious causes.

Also could you rebase or fix the merge conflict? Had an cause of license typo that was fixed which cascaded all PR to be annoyed at it xD

Crowdedlight commented 8 months ago

Also, if you had a screenshot handy of how it looks with preview function as I recall you redid the UI too, that would be great to have here :)

EDIT: I think I misremembered. It was drawbuild UI you had changed. My bad!

Crowdedlight commented 7 months ago

I added a whole new wiki for this mod. If possible please rebase on latest develop and fix any merge conflicts. And edit the entry for playsound and addsound to denote how preview works, or just that is available ;-)

You can see the current wiki here: https://crowdedlight.github.io/Crows-Electronic-Warfare/

You can add new pages in folders or new folders if necessary. Then add them as pages to the book by editing the SUMMERY.md file.

If you want to test it locally, you just need to install "mdbooks" with cargo install mdbook and then in the root of the repo just go mdbook serve and you can see your current state in localhost browser. (Requires you got Rust/Cargo installed)

Landric commented 7 months ago

Still need to update the wiki, but I'll get on that as soon as I can 👍