Author Topic: BASS_Split_StreamCreate()Error Code:20  (Read 124 times)

YAN HONG

  • Posts: 5
BASS_Split_StreamCreate()Error Code:20
« on: 21 Oct '24 - 09:13 »
Hi all,

  I use the BASSMix 2.4.12 dynamic library to implement the audio streaming operation. In the Windows system, the Debug and Release versions of Win32 are tested successfully.The Dubug version of x64 is also tested successfully.
  However, the Release version of x64  reported an error.

 The error message is: Error creating split stream 0: 20
 Here is a part of my code:

Code: [Select]
void createStreams(int numStreams) {
        for (int i = 0; i < numStreams; ++i) {
           
            HSTREAM splitStream = BASS_Split_StreamCreate(mainStream, BASS_STREAM_DECODE, &i);
            if (!splitStream) {
                throw std::runtime_error("Error creating split stream " + std::to_string(i) + ": " + std::to_string(BASS_ErrorGetCode()));
            }
            splitStreams.push_back(splitStream);
        }
    }

Why does this happen?

Ian @ un4seen

  • Administrator
  • Posts: 26172
Re: BASS_Split_StreamCreate()Error Code:20
« Reply #1 on: 21 Oct '24 - 11:59 »
Error code 20 is BASS_ERROR_ILLPARAM, which indicates that the "chanmap" parameter is invalid. It should be a pointer to an array of channel indexes ending with -1. So you could do this:

Code: [Select]
            int map[2] = { i, -1 };
            HSTREAM splitStream = BASS_Split_StreamCreate(mainStream, BASS_STREAM_DECODE, map);