DJRobX

New VPX feature - Surround sound output

46 posts in this topic

I've just finished up a new feature for VPX - full 3D surround sound output for table effects.    There are a few different ways this can be set up:

1) Basic 2CH audio - this should operate exactly as it did before.   Forward/rear panning is ignored.

2) All effects to rear - Moves the table sounds to the back audio channels.   This allows you to move the sounds into the cab like we were able to before, but without needing a second sound card.

3) Surround, front is front - This is the best setting if using a dedicated card for the surround sound table sounds.   It makes the front channels the front of your cab (closest to you).  This way if you use older versions of VP, the old legacy output still works well.

4) Surround, front is rear - This is a pretty "vanilla" surround setup.  If you were to play on a home theater or with virtual 3D headphones, it's the most appropriate.   The "front" speakers are in the rear of the cab (furthest from you).    If VPinmame is also on the same card, will shares the audio with these front channels. 

5) 7.1 surround (aka 6ch audio).   If you want to drive your backglass, and 4 channel table sounds all off of one card, this is the setting to use.  It shifts all of the table audio to the side and rear channels, leaving the fronts available for VPM and backglass sounds.   This might also be a good setting to try if you are using just 2 speakers in the cab and 2 in the backbox,, the table sounds will pan partially towards the front in 4 speaker mode, letting the backbox give some of the surround effect.

Please note that these modes are used in conjunction with the Windows speaker configurations.   You can use any mode on any speaker system.   Some sound cards even have virtual surround options that would work with this setup.   You could set up a full 7.1 setup and dedicate it to just the playfield if you wanted with option #3 or #4, and use a separate card for VPM.   I have tested the 7.1 mode and it works great, but I will use the #3 option for now as it is the most backwards compatible with VP9 and VP9 PhysMod5. 

Next up, we have changes to VPX to let us actually use these.   There's a much revamped sound manager that lets you tweak the positions without touching the table script.   So you can select the flippers and drag them down to the front of the cab right from there.    There is also a new Fade parameter added to the PlaySound command that lets the scripts fully position the sound. 

Making the ball go full surround is fairly easy.  Most tables are already set up for left/right panning, so you just add an additional,  very similar function for front/rear fading:

function AudioFade(ball)
	Dim tmp
    tmp = ball.y * 2 / Table1.height-1
    If tmp > 0 Then
		AudioFade = Csng(tmp ^10)
    Else
        AudioFade = Csng(-((- tmp) ^10) )
    End If
End Function

Then add the 9th parameter to PlaySound to include this function.  For example, in Scared Stiff it looks like this:

PlaySound("fx_ballrolling" & b), -1, Vol(BOT(b) )*1.2, Pan(BOT(b) ), 0, Pitch(BOT(b) ), 1, 0, AudioFade(BOT(b))

I've also done some pretty extensive work to fix the issues that required a VP restart every time you change the sound config.    You can now flip the output between backglass and table or change the target sound cards without a restart. 

WARNING 

Because of the new sound manager features this increases the VP file version.   Please make sure to back up your tables if you experiment with this build. 

Hey @toxie, I've committed this into my github here

https://github.com/djrobx/vpinballx

if you'd like to review and integrate.   I spent quote a lot of time on this one, it's much more robust than the original 2-output hack that you integrated from me the last time.    I know you want to move to BASS at some point.   This isn't mutually exclusive with that. and might help you somewhat since I tried to eliminate some of the rampant code duplication, and steer some of the DirectSound stuff into PinSound.cpp. :)

 

Screen Shot 2017-07-08 at 10.20.10 AM.png

Screen Shot 2017-07-08 at 10.21.20 AM.png

Screen Shot 2017-07-08 at 10.20.46 AM.png

Screen Shot 2017-07-08 at 10.20.30 AM.png

VPinballX.zip

Share this post


Link to post
Share on other sites

I knew it had to be a reason you've been so quiet lately :)

Excited !

Share this post


Link to post
Share on other sites

I've been testing some tables today with my PMD installation and it's just brilliant Rob.

I really hope this makes its way to the official release and that table authors start using the power that this offers.

To have the AudioFade(ActiveBall) in the scripts (where applicable) from the get go would be excellent. Then users need only tweak the remaining sound positioning to their liking using the SoundManager. 

Share this post


Link to post
Share on other sites

Yeah, I'm also hoping that by having the positional settings in the sound manager, that table authors will be more likely to set them correctly out of the gate for things that are not controlled by the script.

Share this post


Link to post
Share on other sites

Neat! For whatever reason your @toxie did not work and i did not get a notification, so thanks for the PM!

I'll have a look and most likely add it then directly to trunk!

Share this post


Link to post
Share on other sites

Looking good to me.

Thanks a lot! This was also one of my many many todos as people requested that already a lot of times, and this looks better than what i've imagined to do.  :)

Share this post


Link to post
Share on other sites
On 11 July 2017 at 3:59 AM, toxie said:

..and it's in now.. Thanks!

Awesome toxie

I'm one of those who has requested sound control a number of times, so I can't thank you enough for it's inclusion.

I've been testing this with Rob using my PMD (Poor Man's DOF) system and as good as my PMD was, this is a game changer!  The example I have been using to describe how good it is, is the Martian Attack in AFM. I can now feel and hear four martians and even with my eyes closed, I know exactly where they are and which ones have dropped out when hit. :) 

Share this post


Link to post
Share on other sites

Very cool!  Need to rework my speaker setup in my cab now.

So when are you going to add a cool grid that represents the table to the Sound Position window so you could just click on a spot on the grid and it will translate that to the balance/F/R settings? :D

-Mike

Share this post


Link to post
Share on other sites
13 hours ago, sliderpoint said:

Very cool!  Need to rework my speaker setup in my cab now.

So when are you going to add a cool grid that represents the table to the Sound Position window so you could just click on a spot on the grid and it will translate that to the balance/F/R settings? :D

-Mike

I thought about that, but it's probably more sensible to just make a PlayMechSound function that takes an object.  Then the sound will follow if you move the object around on the table.   

PlayMechSound "fx_flipper1", LeftFlipper

This could easily just be implemented as a VBScript function .. .it's really the same as:

PlaySound("fx_flipper", -1, 1, Pan(LefFlipper ), 0, 1, 1, 0, AudioFade(LeftFlipper)

So something like:

Sub PlayMechSound(sound, tableobj)
	PlaySound(sound, -1, 1, Pan(tableobj), 0,  1, 1, 0, AudioFade(tableobj))
End Sub

Then the sliders are still available for people that want to tweak relative to the "real" positions of sound on the table. 

Share this post


Link to post
Share on other sites

So you gonna make a new patch that features this?  :)

Forget about it, now i get it, This is of course already possible! Will add this to the default table then..

Share this post


Link to post
Share on other sites

And done.. This will be revolutionary if all tables would use this at some point!

Share this post


Link to post
Share on other sites

You are a total rock star, Toxie!  Thank you!   

8 minutes ago, toxie said:

And done.. This will be revolutionary if all tables would use this at some point!

Rusty will have us covered there.   He is to sound positioning what arngrim is to DOF. :)

Share this post


Link to post
Share on other sites

Actually now i wonder why nobody else came up with that idea before. It's so simple to add this to each table element!

But the simple ideas are always the best ones (and the hardest to come up with ;))

Share this post


Link to post
Share on other sites
1 hour ago, DJRobX said:

You are a total rock star, Toxie!  Thank you!   

Rusty will have us covered there.   He is to sound positioning what arngrim is to DOF. :)

I was thinking that it's time to reach out to table authors and offer them a PMD sound modded version of one of their own tables for perusal.  But since discussing the grid/object positioning method with you Rob, I will hold off and see what you can make of it. 

To get table authors onboard and implementing surround sound into their creations from the get go, I think it would be wise that it be developed as much as possible, so that the requirement for table upgrades is minimised. Not only for the author, but for the end user as well.  Let's take a mature product to market and blow peoples socks off. ;)

Share this post


Link to post
Share on other sites

Sorry but is this for people without dof?

Sent from my SAMSUNG-SM-G935A using Tapatalk

Share this post


Link to post
Share on other sites

Both yes and no Umpa. No reason not to use both ;) It is simply surround sound addition, but, that can be extended to vibrations like Rusty has done. I believe we will start to see ideas popping up all around us using this new feature in ways we maybe haven't thought of yet. One thing is for sure. This is awesome !

Share this post


Link to post
Share on other sites

I'll say this, you guys are a creative group.  Love where this is going.  Also great Visual pinball has the flexibility do do these things

Share this post


Link to post
Share on other sites
4 hours ago, umpa said:

Sorry but is this for people without dof?

Sent from my SAMSUNG-SM-G935A using Tapatalk
 

Definitely not.  

Even if you're using DOF, you still have table sounds.   The ball rolling is the most obvious example.    Little sounds when the ball rolls over switches.   Thumps when the ball hits a rubber.   A clunk when it goes into a kicker hole.   A lot of people use a second sound card to send those noises inside the cab, as it makes things so much more realistic.     

With this mod, now you can have those sounds appear to come from the actual locations of where these things are on the table. 

It so happens that Rusty's exciter speaker selection is the perfect candidate to do this.    You can put 4 small speakers on the corners of your cab that sound great, without needing unsightly holes or vents to get the sound through the cabinet wall cleanly.    The fact that they also give a tactile feedback just an awesome bonus.    You can totally feel where the ball is and where things are going on the table.   It's truly amazing and really brought the fun level of my cab up to another level.  



 

Share this post


Link to post
Share on other sites

If anyone is interested in a bit of read, you can see the full development thread of PMD (Poor Man's DOF) at Aussie Arcade

Please note however:  The parts shopping list at the front of the thread may change a little thanks to Rob's awesome VPX mod, as we should now be able to use a true 5.1 or 7.1 Surround Sound Amp, instead of 2 x 2.1 amps.  So please keep that in mind as Rob's VPX Surround develops.

Also Note: Those users who are currently running PMD with the 2 x 2.1 amps, do not need to change amps, as they will continue to work by simply plugging each into a separate port on the computer's surround sound card.  (Of course if your sound card is stereo only, then you will need to upgrade that to support surround. (...and thankfully that's cheap and eazy-peezy)

Share this post


Link to post
Share on other sites

I went with a 2 x 2 amp setup myself (in addition to the 2.1 amp already in the cab).    I didn't see a lot of inexpensive options for 4+ channel amps when I was shopping.

I've done a few full surround conversions now and these are what I would recommend for "helper functions"

Sub PlaySoundAt(soundname, tableobj)
    PlaySound soundname, 1, 1, Pan(tableobj), 0,0,0, 1, AudioFade(tableobj)
End Sub

Sub PlaySoundAtBall(soundname)
    PlaySoundAt soundname, ActiveBall
End Sub

Toxie added a PlayXYSound function in the default table, but IMHO it takes too many parameters to be useful (VBscript doesn't support optional parameters, unfortunately).   The idea behind these is to make it easy to replace the existing PlaySound calls in the script without fussing with all of the more esoteric options.     If you do need more control the original PlaySound command is fine. 

PlaySoundAtBall is good for replacing all of the rollover and collision sounds.    PlaySoundAt is good for almost everything else (spinners, flippers, solenoids, plunger).   Just be careful not to try and pass it a wall object, as they don't have X/Y locations (slings are good examples).   I usually just find a nearby object or primitive and use that for those cases.

With these it only takes a few minutes to take a table to full surround experience.   The only "gotchya" is the script-controlled kicker sounds that don't let you specify more parameters, but you have the new sound manager settings to move those if you really want to make it perfect. 

Share this post


Link to post
Share on other sites

Thanks for the additional explanations.. I also wanted to post something and then forgot about it again..  :/

I'll also try backporting your changes to VP9.9 and PM5, just so that one could use the same sound setup/settings. Or do you think this is unnecessary?

Share this post


Link to post
Share on other sites

Agreed (in principle), but some tables do still only exist on VP9, and if it helps to build a consistent setup and would be easy to merge over (which i think it is), then why not?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now