That's excellent advice RD James and I very much appreciate it but it turns out that this is definitely a Windows bug and that it's caused by a faulty driver. Below I'm pasting some advice I found online and sure enough, I have the faulty driver referred to, even though this problem dates from October last year while this is a new installation on a new Surface Pro 6. If I delete the driver and reboot, Windows simply reinstalls the same faulty driver so the solution described in the advice below does not work. Googling around, I found a very old driver and I have installed that and it works without any problems at all but it has a very old interface and I would feel happier with a newer version if I can find one. I will have a look later.
1. Type Device Manager in the search box
2. Find and expand Sound, video, and game controllers
3. Look for a Realtek device, or a device that has a yellow triangle with an exclamation point
4. Click on the device to select it
5. From the View menu, choose Devices by connection
6. Look at the parent device -- this will be called something like "Intel SST Audio Controller" (Intel Smart Sound Technology driver version 09.21.00.3755)
7. Right-click the controller device
8. Choose Properties
9. Click on the Driver tab.
10. If the driver version is 9.21.0.3755, you have the driver that was sent to you incorrectly.
11. Click Uninstall Device. You will get a popup asking if you want to remove the driver too, as shown.
12. Check the checkbox, so the driver will be removed.
13. Click Uninstall
14. When the driver is uninstalled, reboot your system.
15. Your audio (speakers and headphones) should now work.
The second option is to install Windows Update KB4468550 which Microsoft rolled out at the weekend. This removes the driver automatically from systems that received it incorrectly. (EDIT: this did not work for me and anyway, it doesn't tell you which is the new driver you need to replace the defective one.)
Incidentally it's interesting to know that Foobar uses DirectSound unless you install a WASAPI plugin. I bet a lot of people don't know that - I didn't.