Active Audio Device Name

nc(aname, $index) gives the device name for phone speaker, or the bluetooth connected device at some index. but it has some issues.

SETUP

  • OnePlus 7T (HD1901, no audio jack port, bluetooth always on)
  • OnePlus Bullets Wireless Z (BT Headphone, custom name in device "Bulletz")
  • SmartBuy L60 (BT Speaker, in device custom name "Flipkart Speaker")

PROCESS/ACTIVITIES

  1. No external audio device connected
  2. only headphone connected
  3. only speaker connected
  4. connected speaker & headphone in altering sequence

OBSERVATIONS

  • Phone Speaker is shown as device name "HD1901" (manageable)
  • Bluetooth device's original names appear, not the ones I have set in device
  • Headphone (when speaker not connected) appears at index 1, nc(acount) is 2. Device stays at index 0. (ok, cool, I can do nc(aname, nc(acount) - 1)) to get the name)
  • Speaker (when headphone not connected) appears at index 0, pushing device to index 1. (still I can check if index 0 is equal to device name, then pick from index 1 whenever acount is 2, else pick from index 0)
  • When I connect Speaker then Headphone, actual audio goes to Headphone
    • nc(acount) is 2
    • nc(aname, 1) is device
    • nc(aname, 0) is Speaker
      disconnect Speaker and nc(aname, 0) is Headphone, nc(acount) is still 2
  • When I connect Headphone then Speaker, actual audio goes to Speaker
    • nc(acount) is 2
    • nc(aname, 0) is device
    • nc(aname, 1) is Headphone
      disconnect Headphone and nc(aname, 1) is Speaker, nc(acount) is still 2
  • Multiple devices aren't updated unless I restart KLWP
  • Disconnection updates immediately
  • First Connection takes a while