Sounds redo

View previous topic View next topic Go down

Sounds redo

Post by Glory! koshikii on Sun Jan 15, 2017 10:16 pm

Hey yo.
I've been fondling with routes and I noticed speed independent Track.Announce's only act in the first car. With that, and the addition of PluginManager.NetPlugin.PlaySound(CarIndex);, in mind, I decided to write a specific plug-in for Yutetsu just so the station announcements are played in all cars, but that has proven to be clunky. I then give the following ideas. Should be pretty straight-forward:


Options.AnnounceBehavior Type
Defines how speed independent announces and sta's ArrivalSound and DepartureSound should be treated.
Type: 0 (default) Sounds are played in all cars.
1: Sounds are played only in DriverCar.
2: Sounds are played only in the first car.

Track.Announce File; Speed; CarIndex
Car: overrides Options.AnnounceBehavior
(default) -1: This sound is played on all cars
n: sound is played on the (n+1)th car.

I can't think of a situation where the developer would want all sounds to be played on the first car but the option is there. AnnounceBehavior 1 is there in case of freight trains or differentiated locomotives, mainly purposed for radio talk. Type 0 is default not because it's the current default behavior, it's not, but that would be mackoy's option for a default, since Bve was aimed towards passenger MU's.
Announce CarIndex should be pretty straight forward too.

I am sorry about creating a topic about this non-issue, but my OCD is kind of disturbing me so I kinda had to.
avatar
Glory! koshikii

Posts : 39
Join date : 2016-06-18
Age : 19
Location : Train-less countryside

http://koshikii.web.fc2.com/

Back to top Go down

Re: Sounds redo

Post by leezer3 on Mon Jan 16, 2017 1:23 pm

Interesting thought, but somewhat impractical.

First, a basic explanation of how .announce sounds are triggered:
Each car has two TrackFollowers these are placed at either the two ends (If no axles defined in extensions.cfg) or at the positions defined in extensions.cfg


When a TrackFollower passes over the trigger point for an announcement, if it is not playing, it is added to the sound sources playing in-sim, attached to the appropriate car.

At present, it will only ever trigger for the first car, as a single defined sound buffer can only be attached to one place at a time.

It's actually more work than you think, as if you'd like the sound to play for multiple cars, it's got to be in memory multiple times. (Unlike a texture, we need to seek to a specific point in a sound)
A secondary problem is the total number of available sound sources. The openBVE default is 16 maximum simultaneous sounds, of which 4-5 are generally going to be in use at any given point for motor/ brake sounds etc.
A modern system will probably allow 64+ sources, but whether the current backend will I'm not sure.

I'll keep it in mind, but at the minute this is going to be low priority.

Cheers

leezer3

Posts : 895
Join date : 2011-08-23

http://www.bvecornwall.co.uk

Back to top Go down

View previous topic View next topic Back to top


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