Bass.dll error

Started by Rone4ka,

Rone4ka

I'm encountering a very strange issue. I've built an application using the BASS library that handles audio recording and playback. It works perfectly on PCs running Windows XP, 7, and 10. However, on other machines, I get an error code -1 when initializing the recording process (BASS_RecordStart). I've tried every suggestion I could find, including using asynchronous threads. For debugging purposes, I ran the `rectest.exe` application (from `bass24.zip\c\bin\`) on those same machines, and it works without any errors. Yet, when I compile the application rectest.exe myself from the source code, the error -1 appears. I've tried building it using Delphi as well as two different C compilers (msvs and builder), but I still get the same error -1. I have two questions:
1. What am I doing wrong? 2. Are there any specific requirements for the build process, or are there differences between the provided source code and the compiled binaries `rectest.exe?

Ian @ un4seen

That does indeed sound strange. The pre-compiled examples are built with MinGW but that shouldn't make any difference. Are you definitely using the same BASS.DLL version in all cases? Make sure it's alongside the EXE, not just somewhere in the search path.

What do you see when running the pre-compiled DEVLIST.EXE example? Note it's a console app, so needs to be run in a Command Prompt window.

Rone4ka

Hi Ian,

Thank you for the quick response. I have done extensive testing and the situation remains extremely strange. I have completely ruled out compilers, PE headers, manifests, and digital signatures.

Here is the full summary of what I found and what I've tried:

1. DEVLIST.EXE Output: Works perfectly. Both your pre-compiled rectest.exe and my compiled versions show the exact same devices. The failure happens regardless of which input is selected (Default, USB Microphone, or Loopback).
G:\bass24\c\bin>devlist.exe
Output Devices
1: Default
        driver:
        type: Headphones
        flags: enabled default (4000003)
2: ═рє°эшъш (USB Audio Device)
        driver: {0.0.0.00000000}.{674be795-e216-4782-9937-59ab927c2df0}
        type: Headphones
        flags: enabled default (4000083)
3: Realtek Digital Output (Realtek High Definition Audio)
        driver: {0.0.0.00000000}.{95f484e3-cf77-43b8-beb2-07df39f84666}
        type: SPDIF
        flags: enabled (9000001)

Input Devices
0: Default
        driver:
        type: Microphone
        flags: enabled default (5000003)
1: ╠шъЁюЇюэ (USB Audio Device)
        driver: {0.0.1.00000000}.{f89bfcb8-d19d-4c59-ba88-3cbc958f28c6}
        type: Microphone
        flags: enabled default (5000083)
2: ═рє°эшъш (USB Audio Device)
        driver: {0.0.0.00000000}.{674be795-e216-4782-9937-59ab927c2df0}
        type: Headphones
        flags: loopback enabled (4000009)
3: Realtek Digital Output (Realtek High Definition Audio)
        driver: {0.0.0.00000000}.{95f484e3-cf77-43b8-beb2-07df39f84666}
        type: SPDIF
        flags: loopback enabled (9000009)

G:\bass24\c\bin>pause

2. Compilers Tested: The failure (BASS_RecordStart returns 0 with BASS_ErrorGetCode() == -1) happens with MSVC 2012, MinGW-w64, Borland C++ Builder 6, and Delphi. All of them fail on the problematic PC, while your pre-compiled EXE works flawlessly.

3. PE Header Analysis (dumpbin):
Your official EXE is structurally "old":

Linker version: 2.56

Subsystem version: 4.00

Load Configuration Directory: 0
  • (None)

I used MSVC, and then manually patched the EXE with editbin and CFF Explorer to match your EXE exactly (Subsystem 4.00, removed Load Config, disabled ASLR/DEP). It STILL fails with -1.

4. Resources, Manifest & Signature: I checked both your official EXE and my compiled versions with Resource Hacker. Neither has an embedded Manifest (no resource ID 24). I also checked the file properties: neither EXE is digitally signed. So this is not a UWP Audio Session or signature issue.

5. Other API/Code attempts (all failed with -1):

Calling BASS_RecordStart in a separate worker thread (with CoInitializeEx as MTA).

Explicitly selecting inputs via BASS_RecordSetInput before starting.

Using BASS_RECORD_PAUSE and then BASS_ChannelStart.

Setting BASS_CONFIG_REC_WASAPI to 0 (DirectSound) — this just makes the app hang completely.

6. Environment attempts (all failed):

Checking Windows Event Viewer (no access denied errors for the audio device).

Checking Windows 10 Privacy settings (Microphone access is fully allowed).

My question:
Since we have identical C code, identical bass.dll, identical subsystem versions (4.00), no manifests, and no signatures, what else could possibly differ between your pre-compiled EXE and my locally compiled one?

Is there a specific memory allocation method, a specific heap flag (like /HEAP), or some specific initialization routine that the official rectest.exe uses (perhaps via the old 2.56 linker) which prevents the Realtek driver from throwing BASS_ERROR_UNKNOWN?
Thanks

Ian @ un4seen

I'll send you a debug version to get more info on what's causing the error there.

Rone4ka

Hi Ian,

I'll post the answer here as well, just in case. I don't see a way to attach files here, so I've sent them via email.

Thank you for the debug DLL. We have isolated the exact problem and we are stuck. We need your expertise.

The Key Finding:
The debug logs show that WASAPI is failing with E_INVALIDARG (80070057) inside IAudioClient::Initialize.
Crucially, this happens not only with the USB Microphone but also with the Loopback device. This means it is not a specific hardware driver issue, but a system-level WASAPI/Win10 interaction problem on this specific PC.

Log Analysis:
In the failing log, BASS requests 16-bit PCM:
form 1 2 48000 192000 4 16 0
But the system mixformat is 32-bit float:
mixform 65534 48000 2 32 (3 3)

What we have definitively ruled out:

Compilers/PE Headers: We tested MSVC, MinGW, Delphi, Borland. We patched PE headers to match your official EXE exactly (Subsystem 4.0, no Load Config, no Manifest). It makes no difference.

Threads: Calling BASS_RecordStart in an async worker thread makes no difference.

Formats: We tried BASS_SAMPLE_FLOAT, and we tried BASS_RecordStart(0, 0, ...) to force native format. All return -1.

DirectSound: BASS_SetConfig(BASS_CONFIG_REC_WASAPI, 0) does NOT fix it, it just returns -1 again.

Environment: Windows 10 Privacy settings are fully open.  No conflicting software.

Our Questions:

Why is BASS requesting 16-bit PCM in Shared Mode when the system mixformat is 32-bit float?

Why would IAudioClient::Initialize fail with E_INVALIDARG for a Loopback device when asking for 16-bit?

Is there any hidden BASS config or flag to force IAudioClient::Initialize to use the exact GetMixFormat output without modifying it?

We have attached 4 logs: Working Win7, Working Win10, Failing Win10 (Default), Failing Win10 (USB Mic).

Thank you for your time. We are entirely at your mercy on this one.