weixin_39637363
weixin_39637363
2020-12-29 09:22

ASIO backend

I want to combine a WASAPI input device with an ASIO output device as a single FlexASIO device because most recording & monitoring applications only support opening a single ASIO device for both input and output. This seems technically possible if you support multiple backends simultaneously. It looks like PortAudio already supports ASIO backends.

Additionally, my output device supports simultaneous ASIO and WDM playback, so I can still use it in WASAPI applications while FlexASIO uses the ASIO interface.

I can work around it right now by using WASAPI shared mode in FlexASIO for both input and output, but that adds a lot of latency.

该提问来源于开源项目:dechamps/FlexASIO

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答

10条回答

  • weixin_39959482 weixin_39959482 3月前

    This seems technically possible if you support multiple backends simultaneously.

    Sadly, PortAudio does not support opening a full-duplex stream where the input and output devices are on different backends (Host APIs). Adding such support in PortAudio, or implementing it directly in FlexASIO, is not trivial. I wouldn't expect this feature to be implemented any time soon (or ever).

    There's another potential problem with regard to using ASIO as a FlexASIO backend. ASIO was never designed for multiple drivers to be used in the same process - it uses global process state which gets in the way. I suspect that's a problem that can be worked around with some trickery, but it makes things more difficult.

    点赞 评论 复制链接分享
  • weixin_39637363 weixin_39637363 3月前

    Another approach would be to create a virtual WDM playback device like VoiceMeeter / Hi-Fi CABLE & ASIO Bridge / Virtual Audio Cable (all by the same developer) which mixes WASAPI + ASIO audio into the backend running in WASAPI Exclusive / WDM-KS mode.

    I could use VoiceMeeter for this, but I'm unable to achieve < 10 ms round-trip latency with its virtual ASIO & WDM devices.

    点赞 评论 复制链接分享
  • weixin_39959482 weixin_39959482 3月前

    Another approach would be to create a virtual WDM playback device

    That's way, waaaaay harder than anything else I mentioned so far. Writing a kernel-mode WDM audio driver is not for the faint of heart. I have neither the skills, nor the time, nor the motivation to embark on such a project.

    VoiceMeeter / Hi-Fi CABLE & ASIO Bridge / Virtual Audio Cable (all by the same developer)

    Virtual Audio Cable is not from the same developer as the other three.

    点赞 评论 复制链接分享
  • weixin_39637363 weixin_39637363 3月前

    The SysVAD sample from the WDK seems to build a fully installable driver and virtual playback device. It's still a complicated task of course. I assumed the ASIO driver was similarly complex.

    All those applications seem to be hosted on the same VB-Audio website.

    In any case, thanks for building FlexASIO - it's great!

    点赞 评论 复制链接分享
  • weixin_39959482 weixin_39959482 3月前

    I assumed the ASIO driver was similarly complex.

    It's absolutely not. An ASIO driver is just a DLL that implements a fairly simple user-space API, nothing more. (It's really more of a "plug-in" than a "driver" from an OS perspective.)

    A kernel-space driver is a vastly more complicated piece of machinery with a much wider interface, different development workflows, different challenges, many more moving parts, and way more opportunities for things to go wrong.

    All those applications seem to be hosted on the same VB-Audio website.

    Ah, right, I was confused because there are two things called "Virtual Audio Cable", and I was thinking of the other one.

    点赞 评论 复制链接分享
  • weixin_39658726 weixin_39658726 3月前

    Usage question: I'm currently using PortAudio and ASIO4ALL for my custom audio (Windows 10) app. How do I use FlexASIO in place of ASIO4ALL? Do I need to uninstall ASIO4ALL tp try it? Is there any code change require in how I set up the device using PortAudio? This seems like a great tool! Thanks in advance!

    点赞 评论 复制链接分享
  • weixin_39959482 weixin_39959482 3月前

    Usage question: I'm currently using PortAudio and ASIO4ALL for my custom audio (Windows 10) app. How do I use FlexASIO in place of ASIO4ALL?

    I'm confused by the question. No matter how I look at it, your use case doesn't make sense to me. Do you mean that you use ASIO4ALL through PortAudio, or that you're using ASIO and PortAudio side-by-side? And what would be the point of using FlexASIO, which is a wrapper around PortAudio, if you are already using PortAudio directly?

    点赞 评论 复制链接分享
  • weixin_39658726 weixin_39658726 3月前

    Sorry for the confusion. My intention is to take advantage of your Shared mode which ASIO4ALL doesn't support. Another purpose is to see if I can get better latency and performance in a remote setup (via Windows RDP). Currently, for remote setup, I use WMME as the backend which is bad with latency. I was hoping FlexASIO going through WASAPI may work better.

    I'm using ASIO4ALL through PortAudio by defining a compile flag in PortAudio DLL build and in my project if that makes sense. Thanks!

    点赞 评论 复制链接分享
  • weixin_39959482 weixin_39959482 3月前

    Either you're confused and don't understand what FlexASIO is, or I'm confused and still don't understand what you're trying to do.

    FlexASIO is a thin wrapper around PortAudio. If you use FlexASIO as a PortAudio ASIO backend, what you'll end up doing is PortAudio → FlexASIO → PortAudio. In other words you're back where you're started, just with more layers (and thus more complexity, more latency and more places for things to go wrong). It's pointless.

    Because FlexASIO is just an ASIO driver gateway to PortAudio, there is nothing you can do with FlexASIO that you can't already do in a simpler, more direct way using PortAudio itself.

    You don't need FlexASIO to implement FlexASIO features in your application, because all FlexASIO features are PortAudio features behind the scenes, and you can just use these PortAudio features directly.

    I'm not sure how I can make this clearer because I don't understand your reasoning for wanting to do this in the first place.

    点赞 评论 复制链接分享
  • weixin_39658726 weixin_39658726 3月前

    I admitted I was confused. Thanks for your explanation!

    点赞 评论 复制链接分享