LosslessSwitcher icon indicating copy to clipboard operation
LosslessSwitcher copied to clipboard

LosslessSwitcher doesn't switch sample rate with local files

Open faraway1982 opened this issue 2 years ago • 5 comments

I've noticed that this app only works on Apple Music content and not local files.

faraway1982 avatar Jun 04 '22 16:06 faraway1982

@vincentneo

For local files it would just be a matter of adding tell application "Music" to get sample rate of current track(AppleScript), and if it's unavailable fall back to the current log reading approach.

(not related, but to observe the track changes it'd be better to subscribe to the distributed notification com.apple.Music.playerInfo rather than to poll)

fjolnir avatar Sep 01 '22 03:09 fjolnir

@fjolnir

Thanks for the AppleScript trick. Definitely didn't know about that. I've tried using private MediaRemote API to observe track changes, but that didn't work too well since the console message arrives at unpredictable timings, as it has been observed to usually arrive later than the track change, hence use of polling.

vincentneo avatar Sep 01 '22 16:09 vincentneo

No problem. I was looking for an app like this, but since I mostly play local files, it wasn’t working 😅

You can subscribe to that notification via NSDistributedNotificationCenter. It always arrives instantly on my machine

fjolnir avatar Sep 01 '22 16:09 fjolnir

You can subscribe to that notification via NSDistributedNotificationCenter. It always arrives instantly on my machine

I was referring to the log message arriving at times after the track was switched, which contained the info about the sample rate of the playing Apple Music track. The unpredictability and sometimes inaccuracy of it is a big problem.

vincentneo avatar Sep 01 '22 16:09 vincentneo

I have published a new notarised app binary as v1.1 beta 5 with the AppleScript method proposed.

vincentneo avatar Sep 01 '22 17:09 vincentneo

Refer to discussion #74 for reason of closure.

vincentneo avatar Mar 28 '23 09:03 vincentneo