soundscape-community / soundscape

An iOS application/service that aids navigation through spatialized audio
https://soundscape.services
MIT License
21 stars 22 forks source link

Fix beacon distance callouts at geofence transitions #109

Closed steinbro closed 1 month ago

steinbro commented 1 month ago

There was a very subtle issue with how I implemented the configurable beacon immediate-vicinity distance (#102 ). The original non-configurable implementation had two distance threshold constants, one for entering the vicinity (15m) and one for exiting (30m). The setting I added was only for the first constant, which meant you could set an enter-vicinity distance greater than the exit-vicinity distance. When this was true, the region considered "near" the beacon was no longer a circle drawn around the location, but a donut-shaped area. This led to the weird callout behavior @fraziercarr observed, where walking towards the beacon led to repeated callouts of "Beacon within x units," which would be played each time the user crossed in or out of the donut. I've now updated it so that the exit-vicinity distance is always set to the enter-vicinity distance plus 15m, ensuring the exit-vicinity distance is always the outer of the two circles.

Fixing this revealed another bug. When the enter-vicinity distance was set to larger values (25m+), when walking away from the beacon, you would hear something like "Beacon: 110 feet" before "Beacon within 80ft," which was very confusing since it implied you were walking in the opposite direction. The periodic "Beacon: 110 feet" distance callouts were being prioritized over the "Beacon within 80ft" callout played only when entering or exiting the beacon vicinity. This was because large vicinity radii exceed the normal interval at which distance callouts are announced (50m), and periodic distance callouts are disabled when you are within the beacon vicinity, so the periodic distance callouts were overdue by the time you exited the beacon vicinity. I addressed this by only playing the "Beacon within x units" callouts when entering (not exiting) the beacon vicinity.