pierr3 / TrackAudio

A next generation Audio-For-VATSIM ATC Client for macOS, Linux and Windows
Other
38 stars 8 forks source link

Fix audio issues on Windows, properly handle default config values #133

Closed neilenns closed 2 months ago

neilenns commented 2 months ago

I'm lucky, on Windows my audioApi value is 0. This exposed a host of problems in the code that tested the value of audioApi using logical or. This resulted in a default value of -1 being used when calling afv-native, and basically broke all audio.

Changes:

Verified on Windows the following works:

  1. Deleting the audioApi property from a config file
  2. Selecting an audio API in settings after running with the value missing from the saved config. Result is the UI magically updates and properly shows the saved output and input devices. Yay.
  3. Rx works, tested via listening to KPDX_ATIS in an OBS session
neilenns commented 2 months ago

I think if eslint had @typescript-eslint/stylistic-type-checked rules enabled it would have caught this before it was a problem. The https://typescript-eslint.io/rules/prefer-nullish-coalescing/ rule specifically prefers ?? over || for this very reason.

I might try enabling that and see what else it finds...