Open danryu opened 1 year ago
This is an ASIO host issue. The ASIO driver is telling the ASIO host that it would like to be reloaded, but the ASIO host does not support that kind of request (specifically it does not support the kAsioResetRequest
selector on the asioMessage
callback), and so nothing happens.
Ideally, the ASIO host should support this request and diligently reload the driver in response. Unfortunately, in my experience many ASIO hosts do not support that request, or they support it but not in the most user-friendly way (e.g. they will show a "please reload the driver" message to the user instead of doing it automatically/transparently).
One way to improve on this on the driver side could be to implement a new mechanism in the driver whereby it would try to apply the new configuration "in place" while the stream is running (e.g. by closing and re-opening a PortAudio stream behind the scenes) instead of relying on the host to reload the driver. Obviously there would be quite a few difficulties in doing that: many configuration changes simply cannot be applied that way because they require cooperation from the ASIO host (e.g. different buffer size, different channel count, different sample types, different available sample rates), and it would disrupt callback timing.
@dechamps thanks for pre-empting my question!
I suspected this would have to be resolved host-side. Currently in the Koord app (which has KoordASIO integrated as the "Built-in" driver option) I have to jump through some hoops with each config change - effectively a full unload and reload. Once I handled the corner cases (failover, previous ASIO config invalid, broken config file) it is actually working fine now. https://github.com/koord-live/koord-app/blob/dev/src/sound/asio/sound.cpp#L85-L98
specifically it does not support the
kAsioResetRequest
selector on theasioMessage
callback), and so nothing happens.
I guess I can try and implement the same behavior in this callback, to align with the standard approach.
One way to improve on this on the driver side could be to implement a new mechanism in the driver whereby it would try to apply the new configuration "in place" while the stream is running
The shortcomings you mention make this a no-go IMO. ASIO hosts are the responsible party in this case :)
Once I handled the corner cases (failover, previous ASIO config invalid, broken config file)
To be clear, the driver will not trigger a reset request if a valid config file is replaced by a broken one:
Though obviously this only covers the most basic kinds of "broken", e.g. config file syntax errors.
Though obviously this only covers the most basic kinds of "broken", e.g. config file syntax errors.
Ok this makes sense. In my case (with Koord app) I have to do higher-level validation (number of inputs+outputs, sampling freq) for the ASIO configuration to be successfully loaded. (Somehow I would end up with device=""
on an initialization round and that would trigger the invalidation - etc)
What's particularly nice about having KoordASIO integrated now, is that I don't have to worry about the "no ASIO drivers installed" case. I always have a configurable driver on hand that's pretty much guaranteed to load on the available hardware.
Also potentially much simpler for users.
Use Case:
Currently with Koord app (or Jamulus), if KoordASIO configuration is changed, the KoordASIO driver has to be "manually" released and loaded again in order to reflect the configuration change.
When changing KoordASIO toml configuration, this can be seen in the logs:
Not sure if this is a failure with the ASIO host, or with KoordASIO.