BVE WorldWide
Would you like to react to this message? Create an account in a few clicks or log in to continue.

Animated objects with sound

Go down

Animated objects with sound Empty Animated objects with sound

Post by jpnmtrmn93 Sun Oct 13, 2019 4:24 pm

I guess a basic way to think of this is to trigger a sound when a variable state changes. Here is an example.

Right now, I am working with platform screen doors (PSD's). I have sounds for when they open and close. Currently, the sounds are set up to play as arrival and departure sounds. But if the doors are stuck when closing and they have to open and close again, I will not get the sounds. A solution, which I use on a different route, would be to blend the sounds with the door open and close sounds in the train folder. However, for this route, there are a few stations that do not have PSD's installed yet (to be accurate with reality). I am looking for a way to include a trigger in the .animated file.

Maybe it could look like this:

[sound] (a new section, perhaps?)
States = PSDclose.wav, PSDopen.wav
StateFunction = leftdoorstarget (or rightdoorstarget)

Would this be possible to implement in a future version of the sim?

jpnmtrmn93

Posts : 23
Join date : 2017-05-26

Back to top Go down

Animated objects with sound Empty Re: Animated objects with sound

Post by leezer3 Sun Oct 13, 2019 9:27 pm

https://bveworldwide.forumotion.com/t1314p25-animated-objects-following-the-track-now-with-sound

Need to update the main developer documentation, seem to have never added this there Sad
Will try and do that tomorrow.

Edit:
Documentation updated.
Please let me know if this lets you do what you want (and that it works OK!) Smile

leezer3

Posts : 1785
Join date : 2011-08-23

http://www.bvecornwall.co.uk

Back to top Go down

Animated objects with sound Empty Re: Animated objects with sound

Post by jpnmtrmn93 Mon Oct 14, 2019 6:01 pm

Hello, thanks for the quick response.

I saw the documentation update. Thanks for that. But I do not think that works. Here is the code I tried to use:

Code:
[Sound]
FileName = doorsclosing.wav
Position = -2, 1.25, 12.5
Volume = 1
Pitch = 1
Radius = 25
VolumeFunction = leftdoorstarget

[Sound]
FileName = doorsopening.wav
Position = -2, 1.25, 12.5
Volume = 1
Pitch = 1
Radius = 25
VolumeFunction = Not[leftdoorstarget]

I get this a critical error saying "Unhandled error (Object reference not set to an instance of an object.) encountered while processing the file".

The goal is to have a sound play when the value of leftdoorstarget (or rightdoorstarget) changes from 0 to 1 or vice versa (0 = close, 1 = open, according to the train doors variable table in the documentation).

jpnmtrmn93

Posts : 23
Join date : 2017-05-26

Back to top Go down

Animated objects with sound Empty Re: Animated objects with sound

Post by leezer3 Wed Oct 16, 2019 6:52 pm

Today's build should be better, and at the least not crash (and definitely places the sound appropriately) Smile

Note that something is still a little odd, as it's not interpreting the volume function correctly. Need to dig into this a little further, but will get it sorted as soon as I can.

(I'm away, so testing is a little more difficult this week)

leezer3

Posts : 1785
Join date : 2011-08-23

http://www.bvecornwall.co.uk

Back to top Go down

Animated objects with sound Empty Re: Animated objects with sound

Post by leezer3 Mon Oct 21, 2019 7:30 pm

Issue with the functions now fixed with today's build, apologies that it took a few days to sort out Smile

leezer3

Posts : 1785
Join date : 2011-08-23

http://www.bvecornwall.co.uk

Back to top Go down

Animated objects with sound Empty Re: Animated objects with sound

Post by jpnmtrmn93 Sat Oct 26, 2019 1:25 pm

This is a code I just tried with the build from 10/23 (which is still saying version 1.5, by the way):

Code:
[object]
Position=2.155,0,0.001
States=tv_closeR.csv,tv_closingR.csv,tv_openingR.csv,tv_openR.csv
StateFunction=if[rightdoors==0,0,if[and[rightdoors>0,rightdoors<1],if[rightdoorstarget==0,1,2],3]]
TranslateYFunction = 1.5 * rightdoors

[stateChangeSound]
FileNames=null.wav,close.wav,open.wav,null.wav
Position=2,3.5,12.5
Volume=1
Pitch=1
Radius=50
PlayOnShow=1

Is this the wrong way to set this up?

jpnmtrmn93

Posts : 23
Join date : 2017-05-26

Back to top Go down

Animated objects with sound Empty Re: Animated objects with sound

Post by leezer3 Mon Oct 28, 2019 10:49 am

That seems to work OK here.

Are you placing it as a FreeObj or is it part of the train exterior?
(n.b. As you're using StateChangeSound, the sound will always play to completion. If you're using a long sound effect, this might be confusing things?)

leezer3

Posts : 1785
Join date : 2011-08-23

http://www.bvecornwall.co.uk

Back to top Go down

Animated objects with sound Empty Re: Animated objects with sound

Post by jpnmtrmn93 Mon Oct 28, 2019 12:58 pm

It is a free object, platform screen doors. The object does not load at all.

In Object Viewer, I get these errors:

Error Plugin Object.Animated.dll returned unsuccessfully at LoadObject
Error No plugin found that is capable of loading object

jpnmtrmn93

Posts : 23
Join date : 2017-05-26

Back to top Go down

Animated objects with sound Empty Re: Animated objects with sound

Post by leezer3 Mon Oct 28, 2019 1:29 pm

Odd...
This almost sounds as if it's using the wrong (older) version of the plugins from somewhere unexpected.

Let me do some more testing tomorrow or Wednesday and I'll see if I can reproduce.

N.B.
The main sim is the only place this will definitely work 100%
Route Viewer *ought* to work, but Object Viewer doesn't support sounds. IIRC it should just display an error to that effect, but I'd need to double check what's going on there....

leezer3

Posts : 1785
Join date : 2011-08-23

http://www.bvecornwall.co.uk

Back to top Go down

Animated objects with sound Empty Re: Animated objects with sound

Post by leezer3 Tue Oct 29, 2019 1:26 pm

Some fixes made to Object Viewer today, and my test copy of your object now loads there too.
Still can't find anything wrong in the main sim.

If you're still having issues, I really need to know how you're using the object (track location might be interesting too).

leezer3

Posts : 1785
Join date : 2011-08-23

http://www.bvecornwall.co.uk

Back to top Go down

Animated objects with sound Empty Re: Animated objects with sound

Post by Tony515 Sat Apr 25, 2020 6:57 am

Can there also be support for .animated objects with sound on trains? It currently doesn't seem to work with them.
(See https://bveworldwide.forumotion.com/t1893-sound-section-in-animated-files-for-trains-not-working)
Tony515
Tony515

Posts : 13
Join date : 2020-04-24
Location : New York City, USA

https://www.youtube.com/channel/UCfV997Q6rT3AKS1Xom936Ew

Back to top Go down

Animated objects with sound Empty Re: Animated objects with sound

Post by NYCT_Railer Sun Apr 26, 2020 4:46 am

I would agree with Tony on that suggestion  Idea
NYCT_Railer
NYCT_Railer

Posts : 8
Join date : 2020-04-25

Back to top Go down

Animated objects with sound Empty Re: Animated objects with sound

Post by Sponsored content


Sponsored content


Back to top Go down

Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum