Author Topic: Can't play flac audio  (Read 383 times)

Zarqon

  • Posts: 5
Can't play flac audio
« on: 11 Mar '18 - 15:51 »
I've some problems to play flac audio files with BASS under Windows 8.1. I'm using the NativeBass library for Java, the current BASS version and the following code:

Code: [Select]
BassInit.loadLibraries();
Bass.BASS_PluginLoad("bassflac.dll", 0);
Bass.BASS_Init(-1, 44100, BASS_DEVICE.BASS_DEVICE_SPEAKERS, null, null);
HSTREAM handle1 = Bass.BASS_StreamCreateFile(false, "C:\\Audio\\Song.flac", 0, 0, BASS_STREAM.BASS_STREAM_DECODE);
handle = Bass.BASS_FX_TempoCreate(handle1.asInt(), BASS_FX.BASS_FX_FREESOURCE);
Bass.BASS_ChannelPlay(handle.asInt(), true);

The file is not played and BASS_ErrorGetCode unfortunately retrieves only BASS_ERROR_UNKNOWN.

Ian @ un4seen

  • Administrator
  • Posts: 21372
Re: Can't play flac audio
« Reply #1 on: 12 Mar '18 - 14:16 »
Which call is the BASS_ERROR_UNKNOWN error coming from? If it's the BASS_StreamCreateFile call, is the BASS_PluginLoad call successful, ie. returning a non-0 value?

Zarqon

  • Posts: 5
Re: Can't play flac audio
« Reply #2 on: 13 Mar '18 - 15:40 »
You're right. I'm checking the return value of BASS_StreamCreateFile and if it's 0 (or null in Java) then I call BASS_ErrorGetCode.

The return value of BASS_PluginLoad is 451215360. So I think the plugin should be loaded.

Maybe the problem would be the STREAM_DECODE parameter or the using of BASS_FX but I'm not sure. Until now I only played mp3 files and I only copied the code for flac with the addition of calling BASS_PluginLoad.

Ian @ un4seen

  • Administrator
  • Posts: 21372
Re: Can't play flac audio
« Reply #3 on: 13 Mar '18 - 17:53 »
From that BASS_PluginLoad return value, it looks like you may be using an old BASS.DLL version. If so, please try downloading the latest version and see what result you get with that.

Also try playing the FLAC file with the pre-compiled PLUGINS.EXE example included in the BASS package (C\BIN folder) and see if you can reproduce the problem with that. If the problem does happen with that too, please upload the FLAC file to have a look at here:

   ftp.un4seen.com/incoming/

Zarqon

  • Posts: 5
Re: Can't play flac audio
« Reply #4 on: 14 Mar '18 - 11:50 »
Yepp, I updated bass.dll and bassflac.dll to the current versions and now it works. Thanks!