freezy / VisualPinball.Engine

:video_game: Visual Pinball Engine for Unity
https://docs.visualpinball.org
GNU General Public License v3.0
396 stars 62 forks source link

Add mechanical sound support. #453

Open Mr-Jay-Gatsby opened 1 year ago

Mr-Jay-Gatsby commented 1 year ago

This is the initial commit for the mechanical sounds as discussed here: https://github.com/freezy/VisualPinball.Engine/issues/449.

Main items added are: Sound Asset(scriptable object) Sound Inspector Mechanical Sounds Data Mechanical Sounds Component Mechanical Sounds Inspector ISoundEmitter

Mr-Jay-Gatsby commented 1 year ago

When working in the specific table project, I did add an AudioMixer asset called SoundMixer to try and alter the speed of sounds. I exposed the pitch shifter parameter and called the mixer in the sound inspector script but the setfloat method wasnt working (getfloat did work). I dont know another way to change the speed unless there are some external plugins to use.

freezy commented 1 year ago

I've pushed a few commits. Changes:

Still TODO:

linojon commented 8 months ago

Hello. I've resumed work on this feature. Work in progress resides in my fork branch https://github.com/linojon/VisualPinball.Engine/tree/feature/sounds . I am building it into the Volley table (https://github.com/jsm174/vpe-volley/tree/sounds ). using that as a baseline project and trying get our sounds like the VPX version (https://vpuniverse.com/files/file/8185-volley-gottlieb-1976/ ).

Changes so far:

To test and verify, i am using the vpe-volley project,

Sounds todo:

Plus object collision and ball rolling sounds. I'll make a separate github issue https://github.com/freezy/VisualPinball.Engine/issues/463

linojon commented 7 months ago

i've committed my current work in progress. I have questions, could use some help as i'm still just getting familiar with how VPE works.

Or, we could play one sound for the whole target bank reset (this is what the VPX game does). I tried this and it works but the code is messy, as I needed to add ItemApi to DropTargetBankApi.cs, which (in order to reference local variable MainComponent) requires i derive DropTargetBank from something like MainRenderableComponent, which in turn required i add a bunch of unused methods. See DropTargetBankComponent.cs. If this is a bad idea, i'll clean up the code.

freezy commented 7 months ago

Awesome! Could you open a PR from your branch to feature/sounds? This branch is the rebased version of this PR, that would allow to properly review and at the same time keep @Mr-Jay-Gatsby's work. I'll then close this one here and we can continue discussing there.

About your questions:

Apologies for not being 100% in the context yet. I'll need to re-read the code that has been written so far to be of more use. Many thanks already for your contributions!