Originally, this author posted how to employ an auto bell for locomotive starts and stops. That post is here. This is a rather simplistic way of getting the bell to work automatically. It only employs the Loop sound WAV file but it does work. He had every intention of employing all three files (start, loop, end) sometime in the future. Well, we all know how that "future intention" works and here we are three years in the future.
Recently, a reader of this blog who has employed several of the other methologies presented in this blog sent the author an email showing where he could not get the file to work after adding the start and end sound files. So it looks like that time is now.
First of all if you have not followed and implemented the original method mentioned above, it is recommended you do. You will learn a lot of manipulations that you need to know and you will have a basis for building this more advanced form of the auto bell. The really good thing about this exercise is that it can be built completely utilizing the Simulator and not have to be burned to the decoder until we have it correct.
The original project was simple. If the speed was greater than zero, spd > 0, and less than the max speed we selected, spd < SV16, then ring the bell using the loop WAV, otherwise stop ringing. Now the logic gets more complicated. Whereas the bell ringing happened in a simple State located in a Container, that State now expands to multiple states in the Container to hold the additional logic and sound WAVs. The starting container is shown in figure 1.