Author Topic: Problem with Errors 5 and 8  (Read 520 times)

MnHebi

  • Posts: 3
Problem with Errors 5 and 8
« on: 1 Oct '23 - 08:02 »
Hi, I keep having a problem in my project with Error 5, and Error 8 appearing when seemingly there should be no problem with BASS & BASS Wasapi being initialized. Device numbers get reported after init, so clearly both should be initialized yet I get Bass Error 8. Afterwards playback fails due to that cause Error 5 comes up there.

https://github.com/MnHebi/wgmus/blob/mayhem/wgmus.c is my code
int bass_init() you can find where the devices are initialized, and from there all the way to bass_play is relevant code for playback.

https://pastebin.com/Qi9W2xgt shows the log which reveals

   BASS Device Number is: 0

   BASS WASAPI Device Number is: 40

   BASS Error: 8

Why is Error 8 coming up if device number is reported, clearly init succeeded?

MnHebi

  • Posts: 3
Re: Problem with Errors 5 and 8
« Reply #1 on: 1 Oct '23 - 09:11 »
Alright, I updated the error checking code so it could be spammed more judiciously.

      str = BASS_Mixer_StreamCreate(info.freq, info.chans, BASS_STREAM_DECODE|BASS_SAMPLE_FLOAT);
      dec = BASS_StreamCreate(info.freq, info.chans, BASS_STREAM_DECODE|BASS_SAMPLE_FLOAT, STREAMPROC_DUMMY, 0);
Both of these give out BASS_ERROR_FORMAT.
                BASS_Mixer_StreamAddChannel(str, dec, 0);
Is what gives out BASS_ERROR_HANDLE. I assume the problem lies in the decoder channel here, I don't think it likes STREAMPROC_DUMMY but I seriously don't get how I put my own WasapiProc there.

MnHebi

  • Posts: 3
Re: Problem with Errors 5 and 8
« Reply #2 on: 2 Oct '23 - 12:44 »
Alright, I figured it out and got playback working, still have some rogue Error 5's(Bad Handle) going about. Updated the code on github. Was doing &info gathering before the devices were initialized, but not after. Did that, and hooked the decoder stream inits to the proper streamproc(after some extensive searching through the example files I found a relevant way to reference the custom streamproc).

Not really sure why bass_stop() spams the error random number of times.

https://pastebin.com/ZV9Y3WJD

Ian @ un4seen

  • Administrator
  • Posts: 26172
Re: Problem with Errors 5 and 8
« Reply #3 on: 2 Oct '23 - 17:42 »
From the mention of "bass_stop", does that mean the errors are being logged at line 494? If so, there's no BASS call immediately before that, so it isn't possible to tell where the error was actually produced. The error code will have been set by the last BASS call in that thread, which could have been a while ago. You should probably just remove that check.