Author Topic: BASS_StreamCreateFile returning Unknown Error Code  (Read 382 times)

HeresOtis

  • Guest
Code: [Select]
if (DataHandler::DoesFileExist("wail.wav"))
LOGGER->Log("wail exists");
else
LOGGER->Log("wail does not exists");
HSTREAM test = BASS_StreamCreateFile(false, "wail.wav", NULL, NULL, BASS_SAMPLE_3D | BASS_SAMPLE_MONO | BASS_SAMPLE_LOOP);
LOGGER->Log("Keypress wail test -- BASS Code: %d", BASS_ErrorGetCode());
if (test)
LOGGER->Log("hstream handle valid");
else
LOGGER->Log("hstream not valid");

I'm using this snippet to merely test the function because I have other code that uses it and it gives the same error. This snippet returns -1 Bass Code and I can't figure out why.

Ian @ un4seen

  • Administrator
  • Posts: 20336
Re: BASS_StreamCreateFile returning Unknown Error Code
« Reply #1 on: 7 Jun '17 - 16:09 »
To narrow down what the problem is, does it still happen if you remove the BASS_SAMPLE_3D flag? Please also confirm what platform you are using BASS on.

HeresOtis

  • Guest
Re: BASS_StreamCreateFile returning Unknown Error Code
« Reply #2 on: 8 Jun '17 - 03:10 »
We'll disregard for now. I was sending it to a friend's computer and now it works. So it must've been some other software (file permission?) issue.

HeresOtis

  • Guest
Re: BASS_StreamCreateFile returning Unknown Error Code
« Reply #3 on: 8 Jun '17 - 03:52 »
Okay. So there is an issue when using BASS_SAMPLE_3D flag.
Code: [Select]
BASS_Init(-1, 44100, BASS_DEVICE_3D | BASS_DEVICE_LATENCY, GetForegroundWindow(), nullptr)This doesn't return any error though.

Ian @ un4seen

  • Administrator
  • Posts: 20336
Re: BASS_StreamCreateFile returning Unknown Error Code
« Reply #4 on: 8 Jun '17 - 16:56 »
The BASS_ERROR_UNKNOWN (error code -1) problem is only happening when using the BASS_SAMPLE_3D flag? Does your app have its own window? If so, try using that handle (instead of GetForegroundWindow) in the BASS_Init call. If you don't have a window handle, you could try NULL there instead.

HeresOtis

  • Guest
Re: BASS_StreamCreateFile returning Unknown Error Code
« Reply #5 on: 9 Jun '17 - 17:06 »
So I used GetActiveWindow() and it still returns same error.
I also removed the BASS_DEVICE_3D flag and the 3d stream returns BASS_ERROR_NO3D. I did that to see if the things are working appropriately.
I one point of time with my code, everything was working fine. So if no other solutions can be suggested then I suppose I'll just start fresh project and rebuild my code.

HeresOtis

  • Guest
Re: BASS_StreamCreateFile returning Unknown Error Code
« Reply #6 on: 13 Jun '17 - 04:04 »
Alright, so finally we narrowed down the issue. It is file-specific. We are streaming a WAV file.
We tested two different files, one is 11411 kb/s and the other is 512kb/s. The 512 works, but not the other.
Are there restrictions when it comes to 3d streams?

Ian @ un4seen

  • Administrator
  • Posts: 20336
Re: BASS_StreamCreateFile returning Unknown Error Code
« Reply #7 on: 13 Jun '17 - 16:22 »
3D streams do need to be mono, so perhaps your WAV file is stereo?

HeresOtis

  • Guest
Re: BASS_StreamCreateFile returning Unknown Error Code
« Reply #8 on: 14 Jun '17 - 03:32 »
3D streams do need to be mono, so perhaps your WAV file is stereo?
Thanks. That's what was causing the issue all along.