It actually depends on your use case. If you always want to "pause" the code until the sound plays then it makes sense to move it to PlaySoundFile and call PlaySoundFile with Wait For (as you did).
Another possible approach which is more robust is to add the sounds you want to play to a queue (List) and make PlaySoundFile play all sounds in the queue, one by one. This way you will not need to arbitrary pause other parts of the program. I don't know whether it is relevant for your app or not.
>>
Another possible approach which is more robust is to add the sounds you want to play to a queue (List) and make PlaySoundFile play all sounds in the queue, one by one.
Not sure this would work.
This app works with a service (called Tracker) that passes satnav values (time, latitude, longitude and altitude) to the main app code, about every second or so.
This app has route points on an OSM map and if the distance between the provided latitude and longitude from Tracker is less than X meters (default 12 meters)
then it will trigger playing the relevant direction sound file. The principal of all this is very simple, but it gets seriously complicated if you code for situations where
the people using this take a wrong turn or just walk somehow away from the route or somehow a route point was missed. I think it is the most complicated code (even although it is not much code) I have ever dealt with. Trouble is to test it properly you will need to walk the route.
I think I have it nearly all fixed now though.
Will look at this suggestion though to use a queue with a list holding the sound files or sound files names.
RBS