Code Monkey home page Code Monkey logo

flexasio's Introduction

FlexASIO, the flexible universal ASIO driver

Brought to you by Etienne Dechamps - GitHub

ASIO is a trademark and software of Steinberg Media Technologies GmbH

If you are looking for an installer, see the GitHub releases page.

Description

FlexASIO is a universal ASIO driver, meaning that it is not tied to specific audio hardware. Other examples of universal ASIO drivers include ASIO4ALL, ASIO2KS, ASIO2WASAPI.

Universal ASIO drivers use hardware-agnostic audio interfaces provided by the operating system to produce and consume sound. The typical use case for such a driver is to make ASIO usable with audio hardware that doesn't come with its own ASIO drivers, or where the bundled ASIO drivers don't provide the desired functionality.

While ASIO4ALL and ASIO2KS use a low-level Windows audio API known as Kernel Streaming (also called "DirectKS", "WDM-KS") to operate, and ASIO2WASAPI uses WASAPI (in exclusive mode only), FlexASIO differentiates itself by using an intermediate library called PortAudio that itself supports a large number of operating system sound APIs, which includes Kernel Streaming and WASAPI (in shared and exclusive mode), but also the more mundane APIs MME and DirectSound. Thus FlexASIO can be used to interface with any sound API available on a Windows system. For more information, see the backends documentation.

Among other things, this makes it possible to emulate a typical Windows application that opens an audio device in shared mode. This means other applications can use the same audio devices at the same time, with the Windows audio engine mixing the various audio streams. Other universal ASIO drivers do not offer this functionality as they always open audio devices in exclusive mode.

Requirements

  • Windows Vista or later
  • Compatible with 32-bit and 64-bit ASIO Host Applications

Usage

After running the installer, FlexASIO should appear in the ASIO driver list of any ASIO Host Application (e.g. Cubase, Sound Forge, Room EQ Wizard).

The default settings are as follows:

  • DirectSound backend
  • Uses the Windows default recording and playback audio devices
  • 32-bit float sample type
  • 20 ms "preferred" buffer size

All of the above can be customized using a configuration file. You might want to use a third-party tool such as flipswitchingmonkey's FlexASIO GUI to make this easier.

For more advanced use cases, such as low-latency operation and bit-perfect streaming, see the FAQ.

Troubleshooting

The FAQ provides information on how to deal with common issues. Otherwise, FlexASIO provides a number of troubleshooting tools described below.

Logging

FlexASIO includes a logging system that describes everything that is happening within the driver in an excruciating amount of detail. It is especially useful for troubleshooting driver initialization failures and other issues. It can also be used for verification (e.g. to double-check that FlexASIO is using the device and audio format that you expect).

To enable logging, simply create an empty file (e.g. with Notepad) named FlexASIO.log directly under your user directory (e.g. C:\Users\Your Name Here\FlexASIO.log). Then restart your ASIO Host Application. FlexASIO will notice the presence of the file and start logging to it.

Note that the contents of the log file are intended for consumption by developers. That said, grave errors should stick out in an obvious way (especially if you look towards the end of the log). If you are having trouble interpreting the contents of the log, feel free to ask for help.

Do not forget to remove the logfile once you're done with it (or move it elsewhere). Indeed, logging slows down FlexASIO, which can lead to discontinuities (audio glitches). The logfile can also grow to a very large size over time. To prevent accidental disk space exhaustion, FlexASIO will stop logging if the logfile exceeds 1 GB.

Device list program

FlexASIO includes a program that can be used to get the list of all the audio devices that PortAudio (and therefore FlexASIO) knows about, as well as detailed information about each device.

The program is called PortAudioDevices.exe and can be found in the x64 (64-bit) or x86 (32-bit) subfolder in the FlexASIO installation folder. It is a console program that should be run from the command line. It doesn't matter much which one you use.

Test program

FlexASIO includes a rudimentary self-test program that can help diagnose issues in some cases. It attempts to emulate what a basic ASIO host application would do in a controlled, easily reproducible environment.

The program is called FlexASIOTest.exe and can be found in the x64 (64-bit) or x86 (32-bit) subfolder in the FlexASIO installation folder. It is a console program that should be run from the command line.

It is a good idea to have logging enabled while running the test.

Note that a successful test run does not necessarily mean FlexASIO is not at fault. Indeed it might be that the ASIO host application that you're using is triggering a pathological case in FlexASIO. If you suspect that's the case, please feel free to ask for help.

Reporting issues, feedback, feature requests

FlexASIO welcomes feedback. Feel free to file an issue in the GitHub issue tracker, if there isn't one already.

When asking for help, it is strongly recommended to produce a log while the problem is occurring, and attach it to your report. The output of FlexASIOTest, along with its log output, might also help.


ASIO logo

flexasio's People

Contributors

dechamps avatar threedeejay avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

flexasio's Issues

Optimize FlexASIO latency

The current limitations around latency are described in the README:

FlexASIO has not been designed with latency in mind. That being said, the current version should not add any latency on top of PortAudio itself. The thing is, due to the way ASIO works (static buffer sizes), PortAudio sometimes has no choice but to add additional buffering (which adds latency) in order to meet the requirements of both FlexASIO and the system API it's using.

The way buffer sizes and latency are handled in FlexASIO is very naive, as it was not designed to optimize for latency. That said, there might be some low-hanging fruit there. For example, if we're smarter about the buffer sizes we suggest to the ASIO host application, we might avoid certain situations where PortAudio has to do additional buffering.

Looking at the current code, the main issue is that we're calling Pa_OpenStream() with a specific framesPerBuffer value (the one set in ASIO), which is not great, as the PortAudio documentation explains:

Note: With some host APIs, the use of non-zero framesPerBuffer for a callback stream may introduce an additional layer of buffering which could introduce additional latency. PortAudio guarantees that the additional latency will be kept to the theoretical minimum however, it is strongly recommended that a non-zero framesPerBuffer value only be used when your algorithm requires a fixed number of frames per stream callback.

FlexASIO fails to initialize when there are no input devices

I have observed this while testing FlexASIO with an audio-over-RDP setup in a VM, which doesn't provide any input audio devices at all:

C:\Program Files\FlexASIO\x64>FlexASIOTest_x64.exe
ASIOInit(asioVersion = 2)
-> -1000 [ASE_NotPresent]
asioVersion = 2 driverVersion = 2 name = No ASIO Driver errorMessage = Unable to get device info for device index -1 sysRef = 0000000000000000

Log:

2018-11-18T12:59:23.8776000-00:00 3800 3816 Logfile opened
2018-11-18T12:59:23.8776000-00:00 3800 3816 Log time source: GetSystemTimeAsFileTime
2018-11-18T12:59:23.8776000-00:00 3800 3816 FlexASIO Release x64 0.5a-27-g69668c7 built on 2018-11-18T13:44:27.4696851+00:00
2018-11-18T12:59:23.8776000-00:00 3800 3816 Host process: C:\Program Files\FlexASIO\x64\FlexASIOTest_x64.exe
2018-11-18T12:59:23.8776000-00:00 3800 3816 --- ENTERING CONTEXT: CFlexASIO()
2018-11-18T12:59:23.8776000-00:00 3800 3816 --- EXITING CONTEXT: CFlexASIO() [OK]
2018-11-18T12:59:23.8786000-00:00 3800 3816 --- ENTERING CONTEXT: init()
2018-11-18T12:59:23.8786000-00:00 3800 3816 Attempting to load configuration file: "C:\\Users\\test\\FlexASIO.toml"
2018-11-18T12:59:23.8786000-00:00 3800 3816 Unable to open configuration file: ios_base::failbit set: iostream stream error
2018-11-18T12:59:23.8786000-00:00 3800 3816 PortAudio version: PortAudio V19.6.0-devel, revision 396fe4b6699ae929d3a685b3ef8a7e97396139a4
2018-11-18T12:59:23.8786000-00:00 3800 3816 Enabling PortAudio debug output redirection
2018-11-18T12:59:23.8786000-00:00 3800 3816 Initializing PortAudio
2018-11-18T12:59:23.8796000-00:00 3800 3816 [PortAudio] before paHostApiInitializers[0].
2018-11-18T12:59:23.8976000-00:00 3800 3816 [PortAudio] after paHostApiInitializers[0].
2018-11-18T12:59:23.8976000-00:00 3800 3816 [PortAudio] before paHostApiInitializers[1].
2018-11-18T12:59:23.9046000-00:00 3800 3816 [PortAudio] Cannot create Capture for Primary Sound Capture Driver. Result = 0x88780078
2018-11-18T12:59:23.9196000-00:00 3800 3816 [PortAudio] PA - PlatformId = 0x2
2018-11-18T12:59:23.9196000-00:00 3800 3816 [PortAudio] PA - MajorVersion = 0x6
2018-11-18T12:59:23.9196000-00:00 3800 3816 [PortAudio] PA - MinorVersion = 0x1
2018-11-18T12:59:23.9326000-00:00 3800 3816 [PortAudio] PA - PlatformId = 0x2
2018-11-18T12:59:23.9326000-00:00 3800 3816 [PortAudio] PA - MajorVersion = 0x6
2018-11-18T12:59:23.9326000-00:00 3800 3816 [PortAudio] PA - MinorVersion = 0x1
2018-11-18T12:59:23.9336000-00:00 3800 3816 [PortAudio] after paHostApiInitializers[1].
2018-11-18T12:59:23.9336000-00:00 3800 3816 [PortAudio] before paHostApiInitializers[2].
2018-11-18T12:59:23.9336000-00:00 3800 3816 [PortAudio] WASAPI: device idx: 00
2018-11-18T12:59:23.9336000-00:00 3800 3816 [PortAudio] WASAPI: ---------------
2018-11-18T12:59:23.9336000-00:00 3800 3816 [PortAudio] WASAPI:0| name[Remote Audio]
2018-11-18T12:59:23.9336000-00:00 3800 3816 [PortAudio] WASAPI:0| form-factor[0]
2018-11-18T12:59:23.9336000-00:00 3800 3816 [PortAudio] WASAPI: getting Windows version with GetVersion()
2018-11-18T12:59:23.9336000-00:00 3800 3816 [PortAudio] WASAPI: Windows version = 2
2018-11-18T12:59:23.9336000-00:00 3800 3816 [PortAudio] WASAPI: IAudioClient version = 1
2018-11-18T12:59:23.9366000-00:00 3800 3816 [PortAudio] WASAPI:0| def.SR[44100] max.CH[2] latency{hi[0.050000] lo[0.003000]}
2018-11-18T12:59:23.9366000-00:00 3800 3816 [PortAudio] WASAPI: initialized ok
2018-11-18T12:59:23.9366000-00:00 3800 3816 [PortAudio] after paHostApiInitializers[2].
2018-11-18T12:59:23.9366000-00:00 3800 3816 [PortAudio] before paHostApiInitializers[3].
2018-11-18T12:59:23.9366000-00:00 3800 3816 [PortAudio] Setup called
2018-11-18T12:59:23.9366000-00:00 3800 3816 [PortAudio] Enum called
2018-11-18T12:59:23.9366000-00:00 3800 3816 [PortAudio] Interfaces found: 0
2018-11-18T12:59:23.9386000-00:00 3800 3816 [PortAudio] after paHostApiInitializers[3].
2018-11-18T12:59:23.9386000-00:00 3800 3816 PortAudio initialization successful
2018-11-18T12:59:23.9386000-00:00 3800 3816 Found backend: PortAudio host API index 0 (name: 'MME', type: 2 [MME], default input device: -1, default output device: 1)
2018-11-18T12:59:23.9386000-00:00 3800 3816 Found backend: PortAudio host API index 1 (name: 'Windows DirectSound', type: 1 [DirectSound], default input device: -1, default output device: 2)
2018-11-18T12:59:23.9386000-00:00 3800 3816 Found backend: PortAudio host API index 2 (name: 'Windows WASAPI', type: 13 [WASAPI], default input device: -1, default output device: 4)
2018-11-18T12:59:23.9386000-00:00 3800 3816 Found backend: PortAudio host API index 3 (name: 'Windows WDM-KS', type: 11 [WDMKS], default input device: -1, default output device: -1)
2018-11-18T12:59:23.9386000-00:00 3800 3816 Selecting default PortAudio host API
2018-11-18T12:59:23.9386000-00:00 3800 3816 Selected backend: PortAudio host API index 1 (name: 'Windows DirectSound', type: 1 [DirectSound], default input device: -1, default output device: 2)
2018-11-18T12:59:23.9386000-00:00 3800 3816 Found device: PortAudio device index 0 (name: 'Microsoft Sound Mapper - Output', host API: 0, default sample rate: 44100, max input channels: 0, max output channels: 2, input latency: 0.09 (low) 0.18 (high), output latency: 0.09 (low) 0.18 (high))
2018-11-18T12:59:23.9396000-00:00 3800 3816 Found device: PortAudio device index 1 (name: 'Remote Audio', host API: 0, default sample rate: 44100, max input channels: 0, max output channels: 2, input latency: 0.09 (low) 0.18 (high), output latency: 0.09 (low) 0.18 (high))
2018-11-18T12:59:23.9396000-00:00 3800 3816 Found device: PortAudio device index 2 (name: 'Primary Sound Driver', host API: 1, default sample rate: 44100, max input channels: 0, max output channels: 2, input latency: 0 (low) 0 (high), output latency: 0.12 (low) 0.24 (high))
2018-11-18T12:59:23.9396000-00:00 3800 3816 Found device: PortAudio device index 3 (name: 'Remote Audio', host API: 1, default sample rate: 44100, max input channels: 0, max output channels: 2, input latency: 0 (low) 0 (high), output latency: 0.12 (low) 0.24 (high))
2018-11-18T12:59:23.9396000-00:00 3800 3816 Found device: PortAudio device index 4 (name: 'Remote Audio', host API: 2, default sample rate: 44100, max input channels: 0, max output channels: 2, input latency: 0 (low) 0 (high), output latency: 0.003 (low) 0.05 (high))
2018-11-18T12:59:23.9396000-00:00 3800 3816 Selecting input device
2018-11-18T12:59:23.9396000-00:00 3800 3816 Using default device with index -1
2018-11-18T12:59:23.9396000-00:00 3800 3816 Terminating PortAudio
2018-11-18T12:59:23.9396000-00:00 3800 3816 [PortAudio] TerminateHostApis in
2018-11-18T12:59:23.9396000-00:00 3800 3816 [PortAudio] TerminateHostApis out
2018-11-18T12:59:23.9396000-00:00 3800 3816 PortAudio terminated successfully
2018-11-18T12:59:23.9396000-00:00 3800 3816 Disabling PortAudio debug output redirection
2018-11-18T12:59:23.9396000-00:00 3800 3816 --- EXITING CONTEXT: init() (-999 [ASE_HWMalfunction] Unable to get device info for device index -1)
2018-11-18T12:59:23.9396000-00:00 3800 3816 --- ENTERING CONTEXT: getErrorMessage()
2018-11-18T12:59:23.9396000-00:00 3800 3816 --- EXITING CONTEXT: getErrorMessage() [OK]
2018-11-18T12:59:23.9436000-00:00 3800 3816 Closing logfile

This is not the intended behaviour; FlexASIO should still be able initialize output-only.

FlexASIO 1.4 Causes Polyphone to crash on startup

Hello,
First off I have to thank the developer for this wonderful driver! It works really well for me with all of the software I have used with it thus far. Also it allows me to actually be able to use Ardour on Windows without horrible feedback from monitoring.
I've only been a user for a day or so but I had an issue with FlexASIO 1.4 being installed and Polyphone crashing on startup. I didn't know it was related to FlexASIO until I launched the MS Debugger on the Polyphone crash and traced the DLL tree finding the FlexASIO dll being loaded. I uninstalled FlexASIO and Polyphone started working again.

My OS is: Win7/64Bit
Crash Interaction occurs with: 64bit and 32bit versions of Polyphone 2.0 and 1.9
MS crash debug information point to

Fault Module Name: ucrtbase.DLL

I tried repairing all versions of MS Visual C Runtimes both 32bit and 64bit on my machine as that dll is related to the MS Visual C Runtimes but it still didn't fix the problem. I also did several reboots and application uninstalls/re installs of Polyphone.

I hope this post helps the developer sort it out. Thanks again for a wonderful contribution.

Is it possible to use multiple input devices?

Hey,
first of all, thank you for FlexASIO, seems to be a very cool project.
I was looking for an alternative to Asio4All because I had problems when combining the input from certain interfaces (and couln't find out, if this was because of bugs in the device's drivers or in Asio4All).
So I'm wondering, if FlexASIO is already supporting multiple input devices. As far as I see this is at least not documented in the configuration file description.
If multi device input is not yet supported, do you plan to implement this in the near future?
Kind Regards

FlexASIOTest refuses to play 24-bit file

After creating a 24-bit file using something like:

$ sox --channels 2 --bits 24 --rate 48000 --null 997-1-48000-24.wav synth 30 sine 997 gain -1

With a configuration of sampleType = "Int24", FlexASIOTest 1.4 refuses to play that file:

FATAL ERROR: Cannot playback from file: Unable to read input file: Attempt to read a non-integer number of channels.

This looks like a bug in FlexASIOTest, not FlexASIO itself.

Make the input and output devices configurable

Currently, FlexASIO will open the default audio devices as configured in the Windows audio settings, without giving the user a choice. We should add configuration options for manually selecting input and output devices.

The PortAudio device index could be used, but I'm worried that this is unstable when devices are added and removed - best would probably to use a more stable identifier, such as the device name.

For this to be usable, we will probably need to provide a small utility for listing devices.

As a bonus, this option could also be used to disable a stream (input or output), which would be especially useful to avoid glitches due to clock issues, or to make it easier to find a valid format to open a stream (no need to find a format that is valid for both input and output devices).

Audio glitches when using the MME backend

I've noticed that, with FlexASIO 1.0, when using MME (default settings otherwise), with some USB audio device, audio from REW is glitchy. This doesn't appear to be the same problem as #29 because the stream callbacks do keep firing when using MME.

FlexASIO should be smarter about the default buffer size

Currently, FlexASIO reports a preferred buffer size of 1024 samples, a constant hardcoded value. Some host applications seem to use that without even giving the user a choice; see #19.

#19 is mostly about making that preferred buffer size configurable in FlexASIO so that users can compel host applications to use whatever buffer size they choose. However, I believe improvements can also be made to the default value, so that users don't need to care about the optimal buffer size in the first place.

One way to come up with a buffer size that is more likely to be optimal is to try to open a PortAudio stream with no buffer size set, i.e. paFramesPerBufferUnspecified, observe what buffer size we get back (also log the latencies too, that might be interesting), and just use that as the default size.

This might possibly get rid of some of the latency weirdness seen in #10, because it's likely PortAudio's behaviour in that regard will be more consistent if we give it the freedom to use the most appropriate buffer size.

One should keep in mind PaStreamInfo::suggestedLatency while experimenting with this. One would expect it to have interesting effects on the buffer size that PortAudio settles on.

Make FlexASIO configurable

In #3 multiple users are feeling of pain of having no control of how FlexASIO behaves. We should provide at least some basic way of configuring FlexASIO. Potential configuration knobs could include:

  • Debug output (see #5)
  • Which PortAudio backend to use (WASAPI, DirectSound, etc.), as well as relevant PortAudio options
  • Which device to use (preferably addressed in a way that survives reshuffling of devices)
  • Minimum, maximum and preferred buffer sizes

Doing this in a GUI would take a lot of time that I don't have, so for now we might have to make do with something more basic, like a configuration file or registry entries.

Make the input and output channel counts configurable

Backends behave differently depending on the channel count specified when opening the stream. For example, a backend might decide to downmix when the channel count exceeds the physical channel count of the device.

Currently, FlexASIO opens the device with the maximum device channel count advertised by PortAudio (if we ignore #3). This might not be what the user wants. Besides, I've seen a few cases where the channel count provided by PortAudio doesn't make a ton of sense (e.g. MME advertising 8 channels for a 5.1 device).

For this reason, it would make sense to allow the user to customize the input and output channel counts. I don't think it would be enough to just count the number of channels that the ASIO host application requests in createBuffers(), because that's somewhat ambiguous (there are scenarios where the user might want to use only N channels, but open the device with M > N channels). One exception would be when the requested channel count is zero (see #24).

Migrate FlexASIO to a CMake-based build system

CMake is the future, and is now natively supported by modern versions of Visual Studio. It would make builds faster (more parallelism) and the configuration is easier to maintain than Visual Studio project files.

The migration should be easy enough, albeit tedious. The one thing that might be a bit tricky is the MIDL step that is required to generate the IASIO interface code.

WASAPI Exclusive in full duplex is unusable with REW

Using FlexASIO in full duplex (i.e. simultaneous input and output) with REW works as long as settings are set correctly (in particular, it needs a preferred latency of at least twice the buffer size, presumably because double buffering is not enough for full duplex). This includes MME, DirectSound, WASAPI Shared and WDM-KS.

However, with WASAPI Exclusive, I was unable to make it work. It works in half duplex, but in full duplex the input seems full of glitches (e.g. trying to view a 1 kHz tone in the RTA just shows tons of noise). I was unable to make it work with any buffer size or preferred latency setting. For testing the audio was going through Virtual Audio Cable 4.60 as a software loopback device.

Review and possibly improve FlexASIO buffer management

In the context of developing ASIO401 I ended up writing a document that explains how to do ASIO buffer management properly - because of ambiguities in the ASIO SDK docs this is not nearly as trivial as one would think.

We should review FlexASIO and ensure it follows these guidelines. At first glance it already seems to be doing most things correctly, but we probably want to support ASIOOutputReady() to improve latency.

WASAPI Exclusive full duplex glitching

With REW using FlexASIO 1.0 in full duplex mode with some USB device at 48 kHz, I am unable to get glitch-free playback under any set of parameters (buffer size, suggested latency, shared or exclusive mode). The glitches are infrequent, but they're there.

Meanwhile, I am not getting any glitches under any of the other backends when using a buffer size of 20 ms along with a suggested latency of 60 ms (for example).

Fails to create buffer with 24 bit/96K sampling

Using a GTX 1050 ti HDMI output for multi-channel audio output with Hauptwerk as the host. Buffering works correctly when sampling is set to 24 bit/48K. However, when it is set to 24 bit/96K, Hauptwerk generates the following error message:

"Could not create audio output buffers for ASIO driver 'ASIO:FlexASIO' with a buffer size of 1024 sample frames. Please try re-booting the computer. (Operating system message: ASE_HWMalfunction, code: -999)

Rebooting doesn't fix the problem, setting the sample rate back to 48K does.

Sample rate negotiation with a DAW

If the sample rate is set to 44.1 Khz in the Windows playback device and Windows recording device:

image

and if the previously-selected device was set to 48 Khz in Ableton:

image

then it will cause a failure when opening the device:

image

So it could be useful to see if a sample rate negotiation between Flex and DAW would be possible.

Note: it's a minor / non-urgent / non-critical issue for now, because a solution is to set a sample-rate in the DAW that matches the Windows playback device sample rate, before selecting FlexASIO. For best user experience, it can be interesting to solve this issue (maybe later), so that the end user never sees the "Failed to open device" error.

FlexASIO should support sample types other than 32-bit float

Currently, FlexASIO only reports a 32-bit float sample type (ASIOSTFloat32LSB) to the ASIO host application, regardless of the actual sample type that PortAudio suggests. It is not possible to use a different sample type.

This is not really a problem in practice, as the PortAudio backend that FlexASIO currently selects (WASAPI Shared) goes through the standard Windows audio pipeline, which operates in 32-bit float anyway, so reporting that format is actually the best thing to do.

However, when FlexASIO becomes configurable in #6, users will be able to select other backends, including ones where 32-bit float is not necessarily the best option. We should then report the sample format suggested by PortAudio (which would likely be the native sample format of the backing hardware). It would also make sense to let users override that choice if they so wish, with the option of letting PortAudio convert (with dithering) if necessary, or not (bit-perfect).

There is also the potential problem that some ASIO host applications might not behave correctly when an ASIO driver reports a float sample type. Float is not a sample type that a real hardware ASIO driver would typically support natively, so it might trigger untested paths in applications. That said, no user has complained about such issues yet.

Audio glitches with default settings (DirectSound gets stuck)

I had the same problem as AustinJerry did in the REW thread at AVS forum. He stated it as such:

"After installing and selecting FlexASIO in the REW Settings panel, the only output options in the drop-down are “out 1” and “out 2”. When I selected out 1 and initiated a signal using REW’s tone generator, there was a brief tone from the left speaker which then changed to a distorted tone which I could not stop without exiting REW completely."

I created a log file per your request to Jerry and have attached it here.
FlexASIOlog.zip

Use WASAPI AUTOCONVERTPCM to automatically convert sample rate and channel count in shared mode

Following the investigation in #23 it was my understanding that it is fundamentally impossible to use WASAPI Shared with a sample rate and channel count other than the one used by the Windows audio engine.

However, I recently stumbled upon this official blog post and related WASAPI flags that seem to contradict the above conclusions.

The two interesting flags for format negotiation are AUDCLNT_STREAMFLAGS_AUTOCONVERTPCM and AUDCLNT_STREAMFLAGS_SRC_DEFAULT_QUALITY, which tell Windows that you want the WASAPI audio engine to do any necessary conversions between the client format you are giving it and the playback mix format or recording split format.

AUDCLNT_STREAMFLAGS_AUTOCONVERTPCM 0x80000000 | A channel matrixer and a sample rate converter are inserted as necessary to convert between the uncompressed format supplied to IAudioClient::Initialize and the audio engine mix format.

It would be nice if we could use this in FlexASIO to make it easier to use WASAPI Shared, as format negotiation is a well-known pain point of that particular backend. This will likely require changes to the PortAudio WASAPI backend, however.

FlexASIO doesn't honor the sample rate set in REW

I've noticed something very strange while experimenting with REW 5.19 and FlexASIO 1.0: when the sample rate is changed in REW, it seems like it has no effect in FlexASIO, meaning that FlexASIO keeps using its default sample rate while REW seems to think it's using the sample rate set in the REW settings. This has the consequence of making the audio play too slowly or too fast in REW.

How to set latency?

When using FlexASIO with a DAW (such as Ableton Live or any other), we currently don't have any option to change the latency / buffer size. The usual worflow with other ASIO drivers - such as ASIO4ALL and my soundcards' ASIO drivers - is to click on the small Hardware setup button (see screenshot below) and then a Control Panel GUI is displayed, allowing to change the device latency. This is probably not needed for FlexASIO at this early stage - GUI design is always long to do. Just a simple flexasio.ini configuration file:

latency=1024

would be enough.

Also the Buffer size displayed in Ableton (1024 samples) doesn't match the one automatically selected internally by FlexASIO (3072 samples = 69.7 milliseconds), as it can be seen in the log below (see in particular the parts in bold in the log).

Question: how to manually force an output latency of 1024 or 512 samples?

image

2018-10-28T18:36:24.0302689+01:00 5880 4168 Logfile opened
2018-10-28T18:36:24.0302689+01:00 5880 4168 Log time source: GetSystemTimeAsFileTime
2018-10-28T18:36:24.0302689+01:00 5880 4168 Enabling PortAudio debug output redirection
2018-10-28T18:36:24.0312689+01:00 5880 4168 CFlexASIO::CFlexASIO()
2018-10-28T18:36:24.0312689+01:00 5880 4168 FlexASIO Release x64 0.3a built on 2018-10-27T23:16:46.2283106+01:00
2018-10-28T18:36:24.0312689+01:00 5880 4168 Host process: C:\ProgramData\Ableton\Live 10 Suite\Program\Ableton Live 10 Suite.exe
2018-10-28T18:36:24.0312689+01:00 5880 4168 PortAudio version: PortAudio V19.6.0-devel, revision 396fe4b
2018-10-28T18:36:24.0312689+01:00 5880 4168 CFlexASIO::init()
2018-10-28T18:36:24.0312689+01:00 5880 4168 Initializing PortAudio
2018-10-28T18:36:24.0672710+01:00 5880 4168 Selected host API #2 (Windows WASAPI)
2018-10-28T18:36:24.0672710+01:00 5880 4168 Getting input device info
2018-10-28T18:36:24.0672710+01:00 5880 4168 Selected input device: Microphone interne (Conexant 20672 SmartAudio HD)
2018-10-28T18:36:24.0672710+01:00 5880 4168 Getting output device info
2018-10-28T18:36:24.0672710+01:00 5880 4168 Selected output device: Speakers (Conexant 20672 SmartAudio HD)
2018-10-28T18:36:24.0672710+01:00 5880 4168 Initialized successfully
2018-10-28T18:36:24.0672710+01:00 5880 4168 CFlexASIO::getDriverName()
2018-10-28T18:36:24.0672710+01:00 5880 4168 CFlexASIO::getDriverVersion()
2018-10-28T18:36:24.0672710+01:00 5880 4168 CFlexASIO::getClockSources()
2018-10-28T18:36:24.0672710+01:00 5880 4168 CFlexASIO::setSampleRate(44100)
2018-10-28T18:36:24.0672710+01:00 5880 4168 CFlexASIO::getChannels()
2018-10-28T18:36:24.0672710+01:00 5880 4168 Returning 2 input channels and 2 output channels
2018-10-28T18:36:24.0672710+01:00 5880 4168 CFlexASIO::getBufferSize()
2018-10-28T18:36:24.0672710+01:00 5880 4168 Returning: min buffer size 48, max buffer size 48000, preferred buffer size 1024, granularity 1
2018-10-28T18:36:24.0672710+01:00 5880 4168 CFlexASIO::outputReady()
2018-10-28T18:36:24.0672710+01:00 5880 4168 CFlexASIO::createBuffers(4, 1024)
2018-10-28T18:36:24.0682710+01:00 5880 4168 Buffers instantiated, memory range : 0000000015BFE4B0-0000000015C064B0
2018-10-28T18:36:24.0682710+01:00 5880 4168 ASIO buffer #0 is input channel 0 - first half: 0000000015BFE4B0-0000000015BFF4B0 - second half: 0000000015C024B0-0000000015C034B0
2018-10-28T18:36:24.0682710+01:00 5880 4168 ASIO buffer #1 is input channel 1 - first half: 0000000015BFF4B0-0000000015C004B0 - second half: 0000000015C034B0-0000000015C044B0
2018-10-28T18:36:24.0682710+01:00 5880 4168 ASIO buffer #2 is output channel 0 - first half: 0000000015C004B0-0000000015C014B0 - second half: 0000000015C044B0-0000000015C054B0
2018-10-28T18:36:24.0682710+01:00 5880 4168 ASIO buffer #3 is output channel 1 - first half: 0000000015C014B0-0000000015C024B0 - second half: 0000000015C054B0-0000000015C064B0
2018-10-28T18:36:24.0682710+01:00 5880 4168 Opening PortAudio stream
2018-10-28T18:36:24.0682710+01:00 5880 4168 CFlexASIO::OpenStream(44100, 1024)
2018-10-28T18:36:24.1262744+01:00 5880 4168 CFlexASIO::getChannelInfo()
2018-10-28T18:36:24.1262744+01:00 5880 4168 Channel info requested for input channel 0
2018-10-28T18:36:24.1262744+01:00 5880 4168 Returning: IN 0 FL (Front Left), active, group 0, type 19
2018-10-28T18:36:24.1262744+01:00 5880 4168 CFlexASIO::getChannelInfo()
2018-10-28T18:36:24.1262744+01:00 5880 4168 Channel info requested for input channel 1
2018-10-28T18:36:24.1262744+01:00 5880 4168 Returning: IN 1 FR (Front Right), active, group 0, type 19
2018-10-28T18:36:24.1262744+01:00 5880 4168 CFlexASIO::getChannelInfo()
2018-10-28T18:36:24.1262744+01:00 5880 4168 Channel info requested for output channel 0
2018-10-28T18:36:24.1262744+01:00 5880 4168 Returning: OUT 0 FL (Front Left), active, group 0, type 19
2018-10-28T18:36:24.1262744+01:00 5880 4168 CFlexASIO::getChannelInfo()
2018-10-28T18:36:24.1262744+01:00 5880 4168 Channel info requested for output channel 1
2018-10-28T18:36:24.1262744+01:00 5880 4168 Returning: OUT 1 FR (Front Right), active, group 0, type 19
2018-10-28T18:36:24.1262744+01:00 5880 4168 CFlexASIO::getChannelInfo()
2018-10-28T18:36:24.1262744+01:00 5880 4168 Channel info requested for input channel 0
2018-10-28T18:36:24.1262744+01:00 5880 4168 Returning: IN 0 FL (Front Left), active, group 0, type 19
2018-10-28T18:36:24.1272744+01:00 5880 4168 CFlexASIO::getChannelInfo()
2018-10-28T18:36:24.1272744+01:00 5880 4168 Channel info requested for input channel 1
2018-10-28T18:36:24.1272744+01:00 5880 4168 Returning: IN 1 FR (Front Right), active, group 0, type 19
2018-10-28T18:36:24.1272744+01:00 5880 4168 CFlexASIO::getChannelInfo()
2018-10-28T18:36:24.1272744+01:00 5880 4168 Channel info requested for output channel 0
2018-10-28T18:36:24.1272744+01:00 5880 4168 Returning: OUT 0 FL (Front Left), active, group 0, type 19
2018-10-28T18:36:24.1272744+01:00 5880 4168 CFlexASIO::getChannelInfo()
2018-10-28T18:36:24.1272744+01:00 5880 4168 Channel info requested for output channel 1
2018-10-28T18:36:24.1272744+01:00 5880 4168 Returning: OUT 1 FR (Front Right), active, group 0, type 19
2018-10-28T18:36:24.1272744+01:00 5880 4168 CFlexASIO::getSampleRate()
2018-10-28T18:36:24.1272744+01:00 5880 4168 Returning sample rate: 44100
2018-10-28T18:36:24.1272744+01:00 5880 4168 CFlexASIO::getLatencies()
2018-10-28T18:36:24.1272744+01:00 5880 4168 Returning input latency of 2048 samples and output latency of 3072 samples
2018-10-28T18:36:24.1272744+01:00 5880 4168 CFlexASIO::getLatencies()
2018-10-28T18:36:24.1272744+01:00 5880 4168 Returning input latency of 2048 samples and output latency of 3072 samples
2018-10-28T18:36:24.1272744+01:00 5880 4168 CFlexASIO::getLatencies()
2018-10-28T18:36:24.1272744+01:00 5880 4168 Returning input latency of 2048 samples and output latency of 3072 samples
2018-10-28T18:36:24.1282745+01:00 5880 4168 CFlexASIO::canSampleRate(22050)
2018-10-28T18:36:24.1282745+01:00 5880 4168 CFlexASIO::OpenStream(22050, 0)
2018-10-28T18:36:24.1462755+01:00 5880 4168 Cannot do this sample rate: Invalid device
2018-10-28T18:36:24.1462755+01:00 5880 4168 CFlexASIO::canSampleRate(32000)
2018-10-28T18:36:24.1462755+01:00 5880 4168 CFlexASIO::OpenStream(32000, 0)
2018-10-28T18:36:24.1652766+01:00 5880 4168 Cannot do this sample rate: Invalid device
2018-10-28T18:36:24.1652766+01:00 5880 4168 CFlexASIO::canSampleRate(44100)
2018-10-28T18:36:24.1652766+01:00 5880 4168 CFlexASIO::OpenStream(44100, 0)
2018-10-28T18:36:24.1992785+01:00 5880 4168 Sample rate is available
2018-10-28T18:36:24.2092791+01:00 5880 4168 CFlexASIO::canSampleRate(48000)
2018-10-28T18:36:24.2092791+01:00 5880 4168 CFlexASIO::OpenStream(48000, 0)
2018-10-28T18:36:24.2282802+01:00 5880 4168 Cannot do this sample rate: Invalid device
2018-10-28T18:36:24.2282802+01:00 5880 4168 CFlexASIO::canSampleRate(88200)
2018-10-28T18:36:24.2282802+01:00 5880 4168 CFlexASIO::OpenStream(88200, 0)
2018-10-28T18:36:24.2462812+01:00 5880 4168 Cannot do this sample rate: Invalid device
2018-10-28T18:36:24.2462812+01:00 5880 4168 CFlexASIO::canSampleRate(96000)
2018-10-28T18:36:24.2462812+01:00 5880 4168 CFlexASIO::OpenStream(96000, 0)
2018-10-28T18:36:24.2652823+01:00 5880 4168 Cannot do this sample rate: Invalid device
2018-10-28T18:36:24.2652823+01:00 5880 4168 CFlexASIO::canSampleRate(176400)
2018-10-28T18:36:24.2652823+01:00 5880 4168 CFlexASIO::OpenStream(176400, 0)
2018-10-28T18:36:24.2842834+01:00 5880 4168 Cannot do this sample rate: Invalid device
2018-10-28T18:36:24.2842834+01:00 5880 4168 CFlexASIO::canSampleRate(192000)
2018-10-28T18:36:24.2842834+01:00 5880 4168 CFlexASIO::OpenStream(192000, 0)
2018-10-28T18:36:24.3032845+01:00 5880 4168 Cannot do this sample rate: Invalid device
2018-10-28T18:36:24.3032845+01:00 5880 4168 CFlexASIO::getLatencies()
2018-10-28T18:36:24.3032845+01:00 5880 4168 Returning input latency of 2048 samples and output latency of 3072 samples
2018-10-28T18:36:24.3032845+01:00 5880 4168 CFlexASIO::getLatencies()
2018-10-28T18:36:24.3032845+01:00 5880 4168 Returning input latency of 2048 samples and output latency of 3072 samples
2018-10-28T18:36:24.3062847+01:00 5880 4168 CFlexASIO::getLatencies()
2018-10-28T18:36:24.3062847+01:00 5880 4168 Returning input latency of 2048 samples and output latency of 3072 samples
2018-10-28T18:36:24.3062847+01:00 5880 4168 CFlexASIO::getLatencies()
2018-10-28T18:36:24.3062847+01:00 5880 4168 Returning input latency of 2048 samples and output latency of 3072 samples
2018-10-28T18:36:24.3062847+01:00 5880 4168 CFlexASIO::getLatencies()
2018-10-28T18:36:24.3062847+01:00 5880 4168 Returning input latency of 2048 samples and output latency of 3072 samples
2018-10-28T18:36:24.3062847+01:00 5880 4168 CFlexASIO::getLatencies()
2018-10-28T18:36:24.3062847+01:00 5880 4168 Returning input latency of 2048 samples and output latency of 3072 samples
2018-10-28T18:36:24.3062847+01:00 5880 4168 CFlexASIO::getLatencies()
2018-10-28T18:36:24.3062847+01:00 5880 4168 Returning input latency of 2048 samples and output latency of 3072 samples
2018-10-28T18:36:24.3062847+01:00 5880 4168 CFlexASIO::getLatencies()
2018-10-28T18:36:24.3062847+01:00 5880 4168 Returning input latency of 2048 samples and output latency of 3072 samples
2018-10-28T18:36:24.3072847+01:00 5880 4168 CFlexASIO::start()
2018-10-28T18:36:24.3072847+01:00 5880 4168 The host supports time info
2018-10-28T18:36:24.3072847+01:00 5880 4168 Starting stream
2018-10-28T18:36:24.3072847+01:00 5880 4168 Starting high resolution timer
2018-10-28T18:36:24.3082848+01:00 5880 4168 Started successfully
2018-10-28T18:36:24.3382865+01:00 5880 5932 CFlexASIO::StreamCallback(1024)
2018-10-28T18:36:24.3382865+01:00 5880 5932 Transferring between PortAudio and buffer #0
2018-10-28T18:36:24.3382865+01:00 5880 5932 Firing ASIO bufferSwitchTimeInfo() callback with samplePosition 0, systemTime 33399623000000
2018-10-28T18:36:24.3382865+01:00 5880 5932 Returning from stream callback
2018-10-28T18:36:24.3582876+01:00 5880 5932 CFlexASIO::StreamCallback(1024)
2018-10-28T18:36:24.3582876+01:00 5880 5932 Transferring between PortAudio and buffer #1
2018-10-28T18:36:24.3582876+01:00 5880 5932 Firing ASIO bufferSwitchTimeInfo() callback with samplePosition 1024, systemTime 33399654000000
2018-10-28T18:36:24.3582876+01:00 5880 5932 Returning from stream callback
2018-10-28T18:36:24.3782888+01:00 5880 5932 CFlexASIO::StreamCallback(1024)
2018-10-28T18:36:24.3782888+01:00 5880 5932 Transferring between PortAudio and buffer #0
2018-10-28T18:36:24.3782888+01:00 5880 5932 Firing ASIO bufferSwitchTimeInfo() callback with samplePosition 2048, systemTime 33399674000000
2018-10-28T18:36:24.3782888+01:00 5880 5932 Returning from stream callback
2018-10-28T18:36:24.4082905+01:00 5880 5932 CFlexASIO::StreamCallback(1024)
2018-10-28T18:36:24.4082905+01:00 5880 5932 Transferring between PortAudio and buffer #1
2018-10-28T18:36:24.4082905+01:00 5880 5932 Firing ASIO bufferSwitchTimeInfo() callback with samplePosition 3072, systemTime 33399694000000
2018-10-28T18:36:24.4082905+01:00 5880 5932 Returning from stream callback
2018-10-28T18:36:24.4302917+01:00 5880 5932 CFlexASIO::StreamCallback(1024)
2018-10-28T18:36:24.4302917+01:00 5880 5932 Transferring between PortAudio and buffer #0
2018-10-28T18:36:24.4302917+01:00 5880 5932 Firing ASIO bufferSwitchTimeInfo() callback with samplePosition 4096, systemTime 33399724000000
2018-10-28T18:36:24.4312918+01:00 5880 5932 Returning from stream callback
2018-10-28T18:36:24.4492928+01:00 5880 5932 CFlexASIO::StreamCallback(1024)
2018-10-28T18:36:24.4492928+01:00 5880 5932 Transferring between PortAudio and buffer #1
2018-10-28T18:36:24.4492928+01:00 5880 5932 Firing ASIO bufferSwitchTimeInfo() callback with samplePosition 5120, systemTime 33399747000000
2018-10-28T18:36:24.4492928+01:00 5880 5932 Returning from stream callback
2018-10-28T18:36:24.4692940+01:00 5880 5932 CFlexASIO::StreamCallback(1024)
2018-10-28T18:36:24.4692940+01:00 5880 5932 Transferring between PortAudio and buffer #0
2018-10-28T18:36:24.4692940+01:00 5880 5932 Firing ASIO bufferSwitchTimeInfo() callback with samplePosition 6144, systemTime 33399765000000
2018-10-28T18:36:24.4692940+01:00 5880 5932 Returning from stream callback
2018-10-28T18:36:24.5012958+01:00 5880 5932 CFlexASIO::StreamCallback(1024)
2018-10-28T18:36:24.5012958+01:00 5880 5932 Transferring between PortAudio and buffer #1
2018-10-28T18:36:24.5012958+01:00 5880 5932 Firing ASIO bufferSwitchTimeInfo() callback with samplePosition 7168, systemTime 33399785000000
2018-10-28T18:36:24.5012958+01:00 5880 5932 Returning from stream callback
2018-10-28T18:36:24.5222970+01:00 5880 5932 CFlexASIO::StreamCallback(1024)
...
2018-10-28T18:36:28.6365323+01:00 5880 5932 Returning from stream callback
2018-10-28T18:36:28.6375324+01:00 5880 4168 CFlexASIO::stop()
2018-10-28T18:36:28.6375324+01:00 5880 4168 Stopping stream
2018-10-28T18:36:28.6385324+01:00 5880 4168 Stopping high resolution timer
2018-10-28T18:36:28.6385324+01:00 5880 4168 Stopped successfully
2018-10-28T18:36:28.6385324+01:00 5880 4168 CFlexASIO::disposeBuffers()
2018-10-28T18:36:28.6385324+01:00 5880 4168 Closing PortAudio stream
2018-10-28T18:36:28.6645339+01:00 5880 4168 CFlexASIO::~CFlexASIO()
2018-10-28T18:36:28.6645339+01:00 5880 4168 Closing PortAudio
2018-10-28T18:36:28.6645339+01:00 5880 4168 PortAudio closed successfully
2018-10-28T18:36:28.6645339+01:00 5880 4168 Disabling PortAudio debug output redirection
2018-10-28T18:36:28.9855523+01:00 5880 4168 Closing logfile

Spurious output after stopping a test signal in REW

Steps to reproduce:

  • Open REW.
  • Start playing a test signal using FlexASIO. (e.g. a 1 kHz sine wave)
  • Stop playing the test signal.

Expected result:

Silence.

Actual result:

The test signal keeps playing in some corrupted way.

Weirdly, this only occurs when a test signal is not playing. The test signals themselves work fine.

REW version: V5.20 Beta 6, 64-bit. 48 kHz sample rate.

This was also found in dechamps/ASIO401#16.

Version 0.3a progress

First of all, congratulations @dechamps for the update 0.3a which adds many things:

  • the installation issue on Windows 7 x64 is solved
  • the "erratic behaviour" issue for the playback position cursor (in SoundForge, see screencast video) is solved too! Now Flex works well with SoundForge.
  • logging, etc.

But now it's impossible to open FlexASIO with Ableton Live again.

image

Report:

C:\Program Files\FlexASIO\x64>FlexASIOTest_x64.exe
ASIOInit(asioVersion = 2)
-> 0 [ASE_OK]
asioVersion = 2 driverVersion = 2 name = FlexASIO errorMessage = No ASIO Driver
Error sysRef = 0000000000000000

ASIOGetChannels()
-> 0 [ASE_OK]
Channel count: 2 input, 2 output

ASIOGetBufferSize()
-> 0 [ASE_OK]
Buffer size: min 48 max 48000 preferred 1024 granularity 1

ASIOGetSampleRate()
-> 0 [ASE_OK]
Sample rate: 44100

ASIOCanSampleRate(44100)
-> 0 [ASE_OK]
ASIOSetSampleRate(44100)
-> 0 [ASE_OK]
ASIOGetSampleRate()
-> 0 [ASE_OK]
Sample rate: 44100
ASIOCanSampleRate(96000)
-> -995 [ASE_NoClock]
ASIOCanSampleRate(192000)
-> -995 [ASE_NoClock]
ASIOCanSampleRate(48000)
-> -995 [ASE_NoClock]

Log file:

2018-10-28T09:57:02.2087555+01:00 6132 5812 Logfile opened
2018-10-28T09:57:02.2087555+01:00 6132 5812 Log time source: GetSystemTimeAsFileTime
2018-10-28T09:57:02.2087555+01:00 6132 5812 Enabling PortAudio debug output redirection
2018-10-28T09:57:02.2087555+01:00 6132 5812 CFlexASIO::CFlexASIO()
2018-10-28T09:57:02.2097555+01:00 6132 5812 FlexASIO Release x64 0.3a built on 2018-10-27T23:16:46.2283106+01:00
2018-10-28T09:57:02.2097555+01:00 6132 5812 Host process: C:\ProgramData\Ableton\Live 10 Suite\Program\Ableton Live 10 Suite.exe
2018-10-28T09:57:02.2097555+01:00 6132 5812 PortAudio version: PortAudio V19.6.0-devel, revision 396fe4b6699ae929d3a685b3ef8a7e97396139a4
2018-10-28T09:57:02.2097555+01:00 6132 5812 CFlexASIO::init()
2018-10-28T09:57:02.2097555+01:00 6132 5812 Initializing PortAudio
2018-10-28T09:57:02.3717648+01:00 6132 5812 Selected host API #2 (Windows WASAPI)
2018-10-28T09:57:02.3727648+01:00 6132 5812 Getting input device info
2018-10-28T09:57:02.3727648+01:00 6132 5812 Selected input device: Microphone interne (Conexant 20672 SmartAudio HD)
2018-10-28T09:57:02.3727648+01:00 6132 5812 Getting output device info
2018-10-28T09:57:02.3727648+01:00 6132 5812 Selected output device: Speakers (Conexant 20672 SmartAudio HD)
2018-10-28T09:57:02.3727648+01:00 6132 5812 Initialized successfully
2018-10-28T09:57:02.3727648+01:00 6132 5812 CFlexASIO::getDriverName()
2018-10-28T09:57:02.3727648+01:00 6132 5812 CFlexASIO::getDriverVersion()
2018-10-28T09:57:02.3727648+01:00 6132 5812 CFlexASIO::getClockSources()
2018-10-28T09:57:02.3737649+01:00 6132 5812 CFlexASIO::setSampleRate(48000)
2018-10-28T09:57:02.3737649+01:00 6132 5812 CFlexASIO::getChannels()
2018-10-28T09:57:02.3737649+01:00 6132 5812 Returning 2 input channels and 2 output channels
2018-10-28T09:57:02.3737649+01:00 6132 5812 CFlexASIO::getBufferSize()
2018-10-28T09:57:02.3747650+01:00 6132 5812 Returning: min buffer size 48, max buffer size 48000, preferred buffer size 1024, granularity 1
2018-10-28T09:57:02.3747650+01:00 6132 5812 CFlexASIO::outputReady()
2018-10-28T09:57:02.3747650+01:00 6132 5812 CFlexASIO::createBuffers(4, 1024)
2018-10-28T09:57:02.3747650+01:00 6132 5812 Buffers instantiated, memory range : 000000001CADECB0-000000001CAE6CB0
2018-10-28T09:57:02.3747650+01:00 6132 5812 ASIO buffer #0 is input channel 0 - first half: 000000001CADECB0-000000001CADFCB0 - second half: 000000001CAE2CB0-000000001CAE3CB0
2018-10-28T09:57:02.3757650+01:00 6132 5812 ASIO buffer #1 is input channel 1 - first half: 000000001CADFCB0-000000001CAE0CB0 - second half: 000000001CAE3CB0-000000001CAE4CB0
2018-10-28T09:57:02.3757650+01:00 6132 5812 ASIO buffer #2 is output channel 0 - first half: 000000001CAE0CB0-000000001CAE1CB0 - second half: 000000001CAE4CB0-000000001CAE5CB0
2018-10-28T09:57:02.3757650+01:00 6132 5812 ASIO buffer #3 is output channel 1 - first half: 000000001CAE1CB0-000000001CAE2CB0 - second half: 000000001CAE5CB0-000000001CAE6CB0
2018-10-28T09:57:02.3757650+01:00 6132 5812 Opening PortAudio stream
2018-10-28T09:57:02.3757650+01:00 6132 5812 CFlexASIO::OpenStream(48000, 1024)
2018-10-28T09:57:02.4237678+01:00 6132 5812 Unable to open PortAudio stream: Invalid device
2018-10-28T09:57:02.4237678+01:00 6132 5812 CFlexASIO::getChannels()
2018-10-28T09:57:02.4237678+01:00 6132 5812 Returning 2 input channels and 2 output channels
2018-10-28T09:57:02.4247678+01:00 6132 5812 CFlexASIO::getBufferSize()
2018-10-28T09:57:02.4247678+01:00 6132 5812 Returning: min buffer size 48, max buffer size 48000, preferred buffer size 1024, granularity 1
2018-10-28T09:57:02.4247678+01:00 6132 5812 CFlexASIO::outputReady()
2018-10-28T09:57:02.4247678+01:00 6132 5812 CFlexASIO::createBuffers(4, 1024)
2018-10-28T09:57:02.4247678+01:00 6132 5812 Buffers instantiated, memory range : 000000001CADECB0-000000001CAE6CB0
2018-10-28T09:57:02.4257679+01:00 6132 5812 ASIO buffer #0 is input channel 0 - first half: 000000001CADECB0-000000001CADFCB0 - second half: 000000001CAE2CB0-000000001CAE3CB0
2018-10-28T09:57:02.4257679+01:00 6132 5812 ASIO buffer #1 is input channel 1 - first half: 000000001CADFCB0-000000001CAE0CB0 - second half: 000000001CAE3CB0-000000001CAE4CB0
2018-10-28T09:57:02.4257679+01:00 6132 5812 ASIO buffer #2 is output channel 0 - first half: 000000001CAE0CB0-000000001CAE1CB0 - second half: 000000001CAE4CB0-000000001CAE5CB0
2018-10-28T09:57:02.4257679+01:00 6132 5812 ASIO buffer #3 is output channel 1 - first half: 000000001CAE1CB0-000000001CAE2CB0 - second half: 000000001CAE5CB0-000000001CAE6CB0
2018-10-28T09:57:02.4257679+01:00 6132 5812 Opening PortAudio stream
2018-10-28T09:57:02.4257679+01:00 6132 5812 CFlexASIO::OpenStream(48000, 1024)
2018-10-28T09:57:02.4707705+01:00 6132 5812 Unable to open PortAudio stream: Invalid device
2018-10-28T09:57:02.4707705+01:00 6132 5812 CFlexASIO::disposeBuffers()
2018-10-28T09:57:02.4717705+01:00 6132 5812 disposeBuffers() called before createBuffers()
2018-10-28T09:57:02.4717705+01:00 6132 5812 CFlexASIO::~CFlexASIO()
2018-10-28T09:57:02.4717705+01:00 6132 5812 Closing PortAudio
2018-10-28T09:57:02.4717705+01:00 6132 5812 PortAudio closed successfully
2018-10-28T09:57:02.4717705+01:00 6132 5812 Disabling PortAudio debug output redirection
2018-10-28T09:57:18.0916639+01:00 6132 5812 Closing logfile

First few initial stream callbacks get dropped after starting

2018-11-17T10:59:29.6739034-00:00 15296 13180 --- ENTERING CONTEXT: start()
2018-11-17T10:59:29.6740235-00:00 15296 13180 Checking if the host supports time info
2018-11-17T10:59:29.6741144-00:00 15296 13180 Sending message: selector = 1 [kAsioSelectorSupported], value = 7, message = 0000000000000000, opt = 0000000000000000
2018-11-17T10:59:29.6772770-00:00 15296 13180 Result: 1
2018-11-17T10:59:29.6773864-00:00 15296 13180 Sending message: selector = 7 [kAsioSupportsTimeInfo], value = 0, message = 0000000000000000, opt = 0000000000000000
2018-11-17T10:59:29.6802059-00:00 15296 13180 Result: 1
2018-11-17T10:59:29.6803107-00:00 15296 13180 The host supports time info
2018-11-17T10:59:29.6804044-00:00 15296 13180 Starting high resolution timer
2018-11-17T10:59:29.6805899-00:00 15296 13180 Starting PortAudio stream 0000012E8BF44360
2018-11-17T10:59:29.6858282-00:00 15296 1752 [PortAudio] WASAPI: thread[ priority-0xF class-0x20 ]
2018-11-17T10:59:29.6868441-00:00 15296 1752 --- ENTERING STREAM CALLBACK
2018-11-17T10:59:29.6877403-00:00 15296 1752 Caught exception in stream callback: PortAudio stream callback fired in non-started state
2018-11-17T10:59:29.6878565-00:00 15296 1752 --- EXITING STREAM CALLBACK (0 [paContinue])
2018-11-17T10:59:29.6880152-00:00 15296 1752 --- ENTERING STREAM CALLBACK
2018-11-17T10:59:29.6888429-00:00 15296 1752 Caught exception in stream callback: PortAudio stream callback fired in non-started state
2018-11-17T10:59:29.6889595-00:00 15296 1752 --- EXITING STREAM CALLBACK (0 [paContinue])
2018-11-17T10:59:29.6890933-00:00 15296 1752 --- ENTERING STREAM CALLBACK
2018-11-17T10:59:29.6899491-00:00 15296 1752 Caught exception in stream callback: PortAudio stream callback fired in non-started state
2018-11-17T10:59:29.6900541-00:00 15296 1752 --- EXITING STREAM CALLBACK (0 [paContinue])
2018-11-17T10:59:29.6901898-00:00 15296 1752 --- ENTERING STREAM CALLBACK
2018-11-17T10:59:29.6911424-00:00 15296 1752 Caught exception in stream callback: PortAudio stream callback fired in non-started state
2018-11-17T10:59:29.6912516-00:00 15296 1752 --- EXITING STREAM CALLBACK (0 [paContinue])
2018-11-17T10:59:29.6913869-00:00 15296 1752 --- ENTERING STREAM CALLBACK
2018-11-17T10:59:29.6923909-00:00 15296 1752 Caught exception in stream callback: PortAudio stream callback fired in non-started state
2018-11-17T10:59:29.6925224-00:00 15296 1752 --- EXITING STREAM CALLBACK (0 [paContinue])
2018-11-17T10:59:29.6926526-00:00 15296 1752 --- ENTERING STREAM CALLBACK
2018-11-17T10:59:29.6937474-00:00 15296 1752 Caught exception in stream callback: PortAudio stream callback fired in non-started state
2018-11-17T10:59:29.6938703-00:00 15296 1752 --- EXITING STREAM CALLBACK (0 [paContinue])
2018-11-17T10:59:29.6940050-00:00 15296 1752 --- ENTERING STREAM CALLBACK
2018-11-17T10:59:29.6950284-00:00 15296 1752 Caught exception in stream callback: PortAudio stream callback fired in non-started state
2018-11-17T10:59:29.6951438-00:00 15296 1752 --- EXITING STREAM CALLBACK (0 [paContinue])
2018-11-17T10:59:29.6952764-00:00 15296 1752 --- ENTERING STREAM CALLBACK
2018-11-17T10:59:29.6962891-00:00 15296 1752 Caught exception in stream callback: PortAudio stream callback fired in non-started state
2018-11-17T10:59:29.6964049-00:00 15296 1752 --- EXITING STREAM CALLBACK (0 [paContinue])
2018-11-17T10:59:29.6965375-00:00 15296 1752 --- ENTERING STREAM CALLBACK
2018-11-17T10:59:29.6975482-00:00 15296 1752 Caught exception in stream callback: PortAudio stream callback fired in non-started state
2018-11-17T10:59:29.6976670-00:00 15296 1752 --- EXITING STREAM CALLBACK (0 [paContinue])
2018-11-17T10:59:29.6978006-00:00 15296 1752 --- ENTERING STREAM CALLBACK
2018-11-17T10:59:29.6987532-00:00 15296 1752 Caught exception in stream callback: PortAudio stream callback fired in non-started state
2018-11-17T10:59:29.6988856-00:00 15296 1752 --- EXITING STREAM CALLBACK (0 [paContinue])
2018-11-17T10:59:29.6990354-00:00 15296 1752 --- ENTERING STREAM CALLBACK
2018-11-17T10:59:29.7000055-00:00 15296 1752 Caught exception in stream callback: PortAudio stream callback fired in non-started state
2018-11-17T10:59:29.7001356-00:00 15296 1752 --- EXITING STREAM CALLBACK (0 [paContinue])
2018-11-17T10:59:29.7003119-00:00 15296 1752 --- ENTERING STREAM CALLBACK
2018-11-17T10:59:29.7012822-00:00 15296 1752 Caught exception in stream callback: PortAudio stream callback fired in non-started state
2018-11-17T10:59:29.7014077-00:00 15296 1752 --- EXITING STREAM CALLBACK (0 [paContinue])
2018-11-17T10:59:29.7015364-00:00 15296 1752 --- ENTERING STREAM CALLBACK
2018-11-17T10:59:29.7024956-00:00 15296 1752 Caught exception in stream callback: PortAudio stream callback fired in non-started state
2018-11-17T10:59:29.7026090-00:00 15296 1752 --- EXITING STREAM CALLBACK (0 [paContinue])
2018-11-17T10:59:29.7027407-00:00 15296 1752 --- ENTERING STREAM CALLBACK
2018-11-17T10:59:29.7037108-00:00 15296 1752 Caught exception in stream callback: PortAudio stream callback fired in non-started state
2018-11-17T10:59:29.7038214-00:00 15296 1752 --- EXITING STREAM CALLBACK (0 [paContinue])
2018-11-17T10:59:29.7039594-00:00 15296 1752 --- ENTERING STREAM CALLBACK
2018-11-17T10:59:29.7049125-00:00 15296 1752 Caught exception in stream callback: PortAudio stream callback fired in non-started state
2018-11-17T10:59:29.7050369-00:00 15296 1752 --- EXITING STREAM CALLBACK (0 [paContinue])
2018-11-17T10:59:29.7051663-00:00 15296 1752 --- ENTERING STREAM CALLBACK
2018-11-17T10:59:29.7061016-00:00 15296 1752 Caught exception in stream callback: PortAudio stream callback fired in non-started state
2018-11-17T10:59:29.7062123-00:00 15296 1752 --- EXITING STREAM CALLBACK (0 [paContinue])
2018-11-17T10:59:29.7075991-00:00 15296 13180 PortAudio stream started
2018-11-17T10:59:29.7078129-00:00 15296 13180 --- EXITING CONTEXT: start() [OK]
2018-11-17T10:59:29.7159367-00:00 15296 1752 --- ENTERING STREAM CALLBACK
2018-11-17T10:59:29.7160469-00:00 15296 1752 PortAudio stream callback with input 0000000000000000, output 0000012E8BF574A0, 882 frames, time info (PortAudio stream callback time info with input buffer ADC time 0, current time 218612, output buffer DAC time 218612), flags 0
2018-11-17T10:59:29.7162078-00:00 15296 1752 Transferring between PortAudio and buffer #0
2018-11-17T10:59:29.7162994-00:00 15296 1752 Firing ASIO bufferSwitchTimeInfo() callback with buffer index: 0, time info: (ASIO time with reserved 0 0 0 0, time info (ASIO time info with speed 0, system time 218605329000000, sample position 0, sample rate 48000 Hz, flags 7 [kSystemTimeValid, kSamplePositionValid, kSampleRateValid], reserved 0 0 0 0 0 0 0 0 0 0 0 0), time code (ASIO time code with speed 0, samples 0, flags 0, future 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0))
2018-11-17T10:59:29.7208709-00:00 15296 1752 --- ENTERING CONTEXT: getSamplePosition()
2018-11-17T10:59:29.7209961-00:00 15296 1752 Returning: sample position 0, timestamp 218605329000000
2018-11-17T10:59:29.7211841-00:00 15296 1752 --- EXITING CONTEXT: getSamplePosition() [OK]
2018-11-17T10:59:29.7245881-00:00 15296 1752 bufferSwitchTimeInfo() complete, returned time info: none
2018-11-17T10:59:29.7247033-00:00 15296 1752 Updated buffer index: 1, position: 882, timestamp: 218605373000000
2018-11-17T10:59:29.7248081-00:00 15296 1752 --- EXITING STREAM CALLBACK (0 [paContinue])
2018-11-17T10:59:29.7344336-00:00 15296 1752 --- ENTERING STREAM CALLBACK
2018-11-17T10:59:29.7345900-00:00 15296 1752 PortAudio stream callback with input 0000000000000000, output 0000012E8BF574A0, 882 frames, time info (PortAudio stream callback time info with input buffer ADC time 0, current time 218612, output buffer DAC time 218612), flags 0
2018-11-17T10:59:29.7347521-00:00 15296 1752 Transferring between PortAudio and buffer #1
2018-11-17T10:59:29.7348428-00:00 15296 1752 Firing ASIO bufferSwitchTimeInfo() callback with buffer index: 1, time info: (ASIO time with reserved 0 0 0 0, time info (ASIO time info with speed 0, system time 218605373000000, sample position 882, sample rate 48000 Hz, flags 7 [kSystemTimeValid, kSamplePositionValid, kSampleRateValid], reserved 0 0 0 0 0 0 0 0 0 0 0 0), time code (ASIO time code with speed 0, samples 0, flags 0, future 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0))
2018-11-17T10:59:29.7393867-00:00 15296 1752 --- ENTERING CONTEXT: getSamplePosition()
2018-11-17T10:59:29.7394921-00:00 15296 1752 Returning: sample position 882, timestamp 218605373000000
2018-11-17T10:59:29.7395907-00:00 15296 1752 --- EXITING CONTEXT: getSamplePosition() [OK]
2018-11-17T10:59:29.7459107-00:00 15296 1752 bufferSwitchTimeInfo() complete, returned time info: none
2018-11-17T10:59:29.7461652-00:00 15296 1752 Updated buffer index: 0, position: 1764, timestamp: 218605394000000
2018-11-17T10:59:29.7464028-00:00 15296 1752 --- EXITING STREAM CALLBACK (0 [paContinue])

This is benign, since it recovers after a few callbacks. Most likely this is caused by the stream callback racing with ::flexasio::FlexASIO::PreparedState::RunningState() or something like that.

FlexASIO should not open the input or output stream direction if it's not used

Currently, if both input and output devices are available, but the ASIO Host Application only opens channels for one direction (i.e. input or output), FlexASIO will still open a full-duplex PortAudio stream. In other words, FlexASIO calls Pa_OpenStream() with both input and output devices even if the ASIO Host Application calls createBuffers() with a set of ASIOBufferInfos that are all input channels, or all output channels.

Ideally, FlexASIO should not open a device that it's not going to use, because that increases the likelihood of clock mismatch issues.

As part of #22 I will introduce a way to disable one side of the stream. This helps, but ideally FlexASIO should just figure this out on its own.

Cannot designate a specific output device due to name duplication

I'm using Windows WDM-KS backend.

My configuration is,

backend = "Windows WDM-KS"

[input]
device = ""
suggestedLatencySeconds = 0.0
wasapiExclusiveMode = true

[output]
device = "라인 (MG-XU)"
suggestedLatencySeconds = 0.0
wasapiExclusiveMode = true

When I do PortAudioDevices.exe, I see the following two devices for WDM-KS:

Device index: 56
Device name: 라인 (MG-XU)
Default sample rate: 48000
Input: max channel count 2, default latency 0.01s (low) 0.0853333s (high)
Output: max channel count 0, default latency 0.01s (low) 0.0853333s (high)
Host API name: Windows WDM-KS
Host API type: 11 [WDMKS]

Device index: 57
Device name: 라인 (MG-XU)
Default sample rate: 48000
Input: max channel count 0, default latency 0.01s (low) 0.0853333s (high)
Output: max channel count 2, default latency 0.01s (low) 0.0853333s (high)
Host API name: Windows WDM-KS
Host API type: 11 [WDMKS]

The output of FlexASIOTest is,

C:\Program Files\FlexASIO\x64>FlexASIOTest.exe
ASIOInit(asioVersion = 2)
-> -1000 [ASE_NotPresent]
asioVersion = 2 driverVersion = 2 name = No ASIO Driver errorMessage = Selected output device has no output channels sysRef = 0000000000000000

I think the issue comes from the device name being identical for input and output and FlexASIO tries to find any device -- sequentially from the lowest device index -- with the same device name only if it's on WDM-KS, hence catching device index #56 for the output device.

However, I don't know how to change the friendlyName for WDM-KS endpoint. (BTW, "라인" is Line in Korean, and it's Windows default)

Installer - Restart Issue

Hi,

I just want to let you know that the installer doesn't respect the user choice to "restart the PC on my own later" after the installation is complete and restarts the PC anyway - which is kind of not OK ;)

FlexASIOTest should play a test signal and record

Currently, FlexASIOTest doesn't touch the buffers that FlexASIO gives it. It would be more useful if it sent an actual test signal (e.g. some sine wave) to the output, and recorded the input to a file. This would make it possible to catch issues with the signal itself, in particular glitches.

Install is failing with "FAILED: portaudio-prefix/src/portaudio-stamp/portaudio-build" error

1> Command line: c:\program files (x86)\microsoft visual studio\2017\professional\common7\ide\commonextensions\microsoft\cmake\CMake\bin\cmake.exe  -G "Ninja" -DCMAKE_INSTALL_PREFIX:PATH="C:\Users\ankurs3\CMakeBuilds\a439ff54-9f66-4932-ad12-8455872089c9\install\x64-Debug (default)"  -DCMAKE_CXX_COMPILER="C:/Program Files (x86)/Microsoft Visual Studio/2017/Professional/VC/Tools/MSVC/14.16.27023/bin/HostX64/x64/cl.exe"  -DCMAKE_C_COMPILER="C:/Program Files (x86)/Microsoft Visual Studio/2017/Professional/VC/Tools/MSVC/14.16.27023/bin/HostX64/x64/cl.exe"  -DCMAKE_BUILD_TYPE="Debug" -DCMAKE_MAKE_PROGRAM="c:\program files (x86)\microsoft visual studio\2017\professional\common7\ide\commonextensions\microsoft\cmake\Ninja\ninja.exe" "E:\akankshaa\flexasio\src"
1> Working directory: C:\Users\ankurs3\CMakeBuilds\a439ff54-9f66-4932-ad12-8455872089c9\build\x64-Debug (default)
1> -- Configuring done
1> -- Generating done
1> -- Build files have been written to: C:/Users/ankurs3/CMakeBuilds/a439ff54-9f66-4932-ad12-8455872089c9/build/x64-Debug (default)
1> Starting CMake target info extraction ...
1> CMake server connection made.
1> Extracted includes paths.
1> Extracted CMake variables.
1> Extracted source files and headers.
1> Extracted global settings.
1> Extracted code model.
1> Extracted CTest info.
1> Collating data ...
1> Target info extraction done.

Build succeeded.
[0/22] Performing build step for 'dechamps_cpputil'
ninja: no work to do.
[1/22] Performing build step for 'portaudio'
[1/5] cmd.exe /C "cd /D "C:\Users\ankurs3\CMakeBuilds\a439ff54-9f66-4932-ad12-8455872089c9\build\x64-Debug (default)\portaudio-prefix\src\portaudio-build" && "C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\cmake.exe" -DPORTAUDIO_LIST_DIR="E:/akankshaa/flexasio/src/portaudio" -DOUTPUT_HEADER_FILE="C:/Users/ankurs3/CMakeBuilds/a439ff54-9f66-4932-ad12-8455872089c9/build/x64-Debug (default)/portaudio-prefix/src/portaudio-build/flexasio_version_stamp.h" -DGit_FOUND="TRUE" -DGIT_EXECUTABLE="C:/Program Files/Git/cmd/git.exe" -P E:/akankshaa/flexasio/src/portaudio_version_stamp.cmake"
[2/5] Building C object CMakeFiles\portaudio.dir\src\common\pa_front.c.obj
FAILED: CMakeFiles/portaudio.dir/src/common/pa_front.c.obj 
C:\PROGRA~2\MIB055~1\2017\PROFES~1\VC\Tools\MSVC\1416~1.270\bin\Hostx64\x64\cl.exe  /nologo -DPAWIN_USE_DIRECTSOUNDFULLDUPLEXCREATE -DPAWIN_USE_WDMKS_DEVICE_INFO -DPA_ENABLE_DEBUG_OUTPUT -DPA_LITTLE_ENDIAN -DPORTAUDIO_CMAKE_GENERATED -D_CRT_SECURE_NO_WARNINGS -Dportaudio_EXPORTS -DUNICODE -D_UNICODE -IE:\akankshaa\flexasio\src\portaudio\src\common -I. -IE:\akankshaa\flexasio\src\portaudio\src\os\win -IE:\akankshaa\flexasio\src\portaudio\include /DWIN32 /D_WINDOWS /W3 /MTd /Zi /Ob0 /Od /RTC1   "/FIC:/Users/ankurs3/CMakeBuilds/a439ff54-9f66-4932-ad12-8455872089c9/build/x64-Debug (default)/portaudio-prefix/src/portaudio-build/flexasio_version_stamp.h" /showIncludes /FoCMakeFiles\portaudio.dir\src\common\pa_front.c.obj /FdCMakeFiles\portaudio.dir\ /FS -c E:\akankshaa\flexasio\src\portaudio\src\common\pa_front.c
E:\akankshaa\flexasio\src\portaudio\src\common\pa_front.c(65): fatal error C1083: Cannot open include file: 'stdio.h': No such file or directory
[3/5] Building C object CMakeFiles\portaudio_static.dir\src\common\pa_front.c.obj
FAILED: CMakeFiles/portaudio_static.dir/src/common/pa_front.c.obj 
C:\PROGRA~2\MIB055~1\2017\PROFES~1\VC\Tools\MSVC\1416~1.270\bin\Hostx64\x64\cl.exe  /nologo -DPAWIN_USE_DIRECTSOUNDFULLDUPLEXCREATE -DPAWIN_USE_WDMKS_DEVICE_INFO -DPA_ENABLE_DEBUG_OUTPUT -DPA_LITTLE_ENDIAN -DPORTAUDIO_CMAKE_GENERATED -D_CRT_SECURE_NO_WARNINGS -DUNICODE -D_UNICODE -IE:\akankshaa\flexasio\src\portaudio\src\common -I. -IE:\akankshaa\flexasio\src\portaudio\src\os\win -IE:\akankshaa\flexasio\src\portaudio\include /DWIN32 /D_WINDOWS /W3 /MTd /Zi /Ob0 /Od /RTC1   "/FIC:/Users/ankurs3/CMakeBuilds/a439ff54-9f66-4932-ad12-8455872089c9/build/x64-Debug (default)/portaudio-prefix/src/portaudio-build/flexasio_version_stamp.h" /showIncludes /FoCMakeFiles\portaudio_static.dir\src\common\pa_front.c.obj /FdCMakeFiles\portaudio_static.dir\portaudio_static.pdb /FS -c E:\akankshaa\flexasio\src\portaudio\src\common\pa_front.c
E:\akankshaa\flexasio\src\portaudio\src\common\pa_front.c(65): fatal error C1083: Cannot open include file: 'stdio.h': No such file or directory
ninja: build stopped: subcommand failed.
[2/22] Performing install step for 'dechamps_cpputil'
[0/1] Install the project...

-- Install configuration: "Debug"
-- Up-to-date: C:/Users/ankurs3/CMakeBuilds/a439ff54-9f66-4932-ad12-8455872089c9/build/x64-Debug (default)/install/include/dechamps_cpputil/endian.h
-- Up-to-date: C:/Users/ankurs3/CMakeBuilds/a439ff54-9f66-4932-ad12-8455872089c9/build/x64-Debug (default)/install/include/dechamps_cpputil/find.h
-- Up-to-date: C:/Users/ankurs3/CMakeBuilds/a439ff54-9f66-4932-ad12-8455872089c9/build/x64-Debug (default)/install/include/dechamps_cpputil/string.h
-- Up-to-date: C:/Users/ankurs3/CMakeBuilds/a439ff54-9f66-4932-ad12-8455872089c9/build/x64-Debug (default)/install/lib/cmake/dechamps_cpputil/dechamps_cpputil-config.cmake
FAILED: portaudio-prefix/src/portaudio-stamp/portaudio-build 
cmd.exe /C "cd /D "C:\Users\ankurs3\CMakeBuilds\a439ff54-9f66-4932-ad12-8455872089c9\build\x64-Debug (default)\portaudio-prefix\src\portaudio-build" && "C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\cmake.exe" --build ."
[4/22] Completed 'dechamps_cpputil'
ninja: build stopped: subcommand failed.
Install failed.

Make it easier to get FlexASIO debug logs

While investigating #3 it became clear that FlexASIO could make it easier to get debug logs. ASIO host applications usually don't provide error details at all (such as which ASIO call failed and how), so we need to surface them through a side channel.

Right now the side channel that FlexASIO uses is OutputDebugString(). This is great for developers, but not so great for end users because it requires them to install a debugger (such as WinDbg) to get the logs.

FlexASIO should instead make it possible to get these logs in a more user-friendly way, such as logging to a file.

Related: #4

64 bit (sup)port

Dear Sir,
Would you be so kind as to port this driver to 64 bit?
My best regards,

Clarify how the latency reported by FlexASIO is computed

Right now, when asked for latency numbers, FlexASIO just responds with whatever PortAudio provides in PaStreamInfo. It's not clear how PortAudio arrives at that number.

It's not even clear if it includes the length of the application-side buffer or not. The current code assumes that it does; if it does not, it means FlexASIO underestimates the latency.

In #3 (comment), @josephernest expressed scepticism at the numbers FlexASIO reports, though only subjective testing was used.

We should investigate the latency computation method used by PortAudio and FlexASIO, determine if it's wrong, and if so, fix it.

SACD, DSD, DSF support

Good day, I was trying to play DSD, DSF (SACD) files via AlbumPlayer2111 x64 and it seems to not be supported (i use a fostex asio driver and a foobar2000 asio driver and both work but not for HDMI audio while FlexASIO does work for that), I also went to the FAQ to see if something about it was stated there but i couldn't find anything for that subject. Is it not supported and will it be supported some day? If it is supported and for some reason i didn't manage to make it work i am attaching my log files to see if there is anything to do about it. One log file while working with flac and the other log file when i couldnt play the SACD format. Thanks in advance for your help.

successful playback of 24 bit 192 khz audio.txt
FlexASIO failed playback of sacd.txt

Make FlexASIO easier to test

Currently, the only way to test FlexASIO is to load it inside an ASIO host application. This is not quick nor automatable.

One approach would be to build a small .exe that simply makes a series of ASIO calls just like a normal ASIO host application would, maybe even try to transfer a few buffers (e.g. one buffer of silence), and then exits. Even simpler could be to add a rundll32 entry point on the FlexASIO DLL itself to do this.

Maybe this could be done by going through the ASIO SDK for host applications, thus closely simulating what a real application would do. The main downside is that it will probably only work for the currently installed system-wide FlexASIO DLL, not for any DLL that one might want to test against (e.g. the one Visual Studio just built).

WASAPI gets the channel count wrong, fails to initialize

Can't use FlexASIO.
Installed everything with the new installer 0.2.
Any DAW says that it can't be openned (see screenshot).
screenshot 2018-10-13 14 35 45_1
I then tried to open FlexASIO using jackd on the command line to see what kind of errors it throws.
(see attached txt log file)
FlexASIO_JackPortaudio_log.txt
I noticed at some point it refering to directories I don't have like:

c:\users\edechamps\downloads\pa_stable_v190600_20161030\portaudio\src\hostapi\wasapi\pa_win_wasapi.c

RegSvr error with version 0.3

When installing FlexASIO-0.3.exe with Windows 7 x64, I get this message:

Imgur

NB: the previous version 0.2 has been successfully uninstalled before trying to install the new one.

I also tried manually but it seems to be the same error:

Imgur

Vendor the PortAudio dependency

FlexASIO capabilities and behaviour tends to be highly dependent on which PortAudio version it's running. For this reason, it would make more sense to "vendor" the PortAudio dependency (i.e. bring it into source control) so that we have more control over the PortAudio library that FlexASIO ships with, and the whole FlexASIO-PortAudio system is bundled as a coherent whole.

This is pretty much a requirement for using PortAudio versions other than the latest stable release, otherwise things are going to be hard to understand and manage. The current PortAudio stable release (pa_stable_v190600_20161030) dates back to 2016 and is not exempt from bugs. Vendoring the library would allow us to use more recent code and pull in any fixes we want.

This would probably be easier if FlexASIO was using CMake (see #36), as PortAudio has explicit support for vendoring in its CMake build system.

Make it easier to get PortAudio debug logs

Some issues can be difficult to troubleshoot even from the FlexASIO debug logs, because often the issue is coming from somewhere within PortAudio. FlexASIO does surface PortAudio error codes in its debug logs but these are notoriously vague, e.g. paInvalidDevice can mean any number of things (see #3 for an example).

PortAudio itself has fairly detailed error logs (see pa_debugprint.c), but they're not easy to get to. They get logged to STDERR, which is accessible for console applications (such as jackd), but, AFAIK, not for graphical applications. As a result, in most cases there is no way to get them.

Fortunately, PortAudio seems to provide a function, PaUtil_SetDebugPrintFunction(), that allows library users to override this behaviour and intercept debug messages themselves. FlexASIO could use that to incorporate PortAudio debug messages into its own debug log.

Investigate why WASAPI Shared requires a matching sample rate

It is now a well-known limitation of the WASAPI Shared backend that the ASIO sample rate has to exactly match the device sample rate as configured in the Windows sound settings, otherwise initialization will fail.

This limitation tends to confuse users, who don't realize the implication that both their input and output devices have to use the same sample rate for WASAPI Shared to work. More generally, this limitation is somewhat surprising in terms of architecture - indeed one would intuitively expect the WASAPI Shared pipeline to provide automatic sample rate conversion.

We should investigate exactly why initialization fails with the WASAPI Shared backend when sample rates don't match. It might be a limitation of WASAPI itself that we can't do anything about, but there is also a possibility that this could be caused by some PortAudio bug, perhaps in the format negotiation logic.

FlexASIO unable to open audio stream due to undefined behavior bug

While doing some testing I found a grave bug in FlexASIO code where CFlexASIO::OpenStream() does not initialize the PortAudio stream parameter structs, and does not set all of them, leading to undefined behaviour when these structs are used in PortAudio.

This leads to FlexASIO being unable to open the audio stream when linked against some versions of PortAudio, including the one shipping with FlexASIO 0.2 (pa_stable_v190600_20161030). Due to the nature of the bug, this can occur at any time and might even fail randomly. In practice I managed to reproduce it on a 32-bit Release build.

FlexASIO timing information appears to be broken

In #3 (comment), @josephernest posted a Source Forge screencast where the cursor position behaves erratically when playing through FlexASIO. One likely explanation is that FlexASIO is reporting timing information in an incorrect way, leaving host applications confused.

In #3 it was also speculated that this might have something to do with MIDI being broken in some host applications while using FlexASIO, as MIDI might be relying on the same timing information.

Using Mingw compiler to build and install

As i was facing problems with visual studio and wdk compatibility , I am using mingw compiler to build and generate ninja files. I have created build.ninja , cmake_install.cmake and other files created at the build time.

Can you please tell the command to install the project. I have used ninja install but it is giving errors that "ninja: build stopped: subcommand failed." is happening.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.