BASS_ERROR_ILLPARAM when trying to create a StreamCreateFileUser from an M4A/AAC

Started by xfx,

xfx

This is going to be a bit complicated to explain, but let me try...
The program works fine with MP3 files. However, when trying to play M4A files (containing AAC streams) the BASS_StreamCreateFileUser function fails with a BASS_ERROR_ILLPARAM when the SPEAKER flags are set to anything but BASS_SPEAKER_FRONT

This is the code used to create the BASS stream handle:
bp.BASSHandle = Bass.BASS_StreamCreateFileUser(BASSStreamSystem.STREAMFILE_NOBUFFER,
                                BASSFlag.BASS_STREAM_AUTOFREE Or BASSFlag.BASS_ASYNCFILE Or
                                spearkerFlags,
                                bp.BASSFile,
                                IntPtr.Zero)

spearkerFlags: contains the flags to set speaker output (such as BASS_SPEAKER_FRONT or BASS_SPEAKER_FRONTLEFT, for example)
bp.BASSFile: is a reference to a BASS_FILEPROCS struct.

BASS works just fine when spearkerFlags is set to something like BASS_SPEAKER_FRONT, but setting it to anything else, such as BASS_SPEAKER_FRONTLEFT fails with BASS_ERROR_ILLPARAM

Any ideas? Do you need anything else from my side to evaluate this issue?

Ian @ un4seen

To narrow down what/where the problem is, please confirm what platform you're running on and whether you're using the BASS_AAC add-on. And does the problem also happen when you use the same flags with BASS_StreamCreateFile instead of BASS_StreamCreateFileUser? Also confirm the BASS version with BASS_GetVersion.

xfx

OS Platform: Windows 11 (26200.7628)
BASS_GetVersion(): 33820679
BASS_AAC: 2.4.7.1 (I also tried version 2.4.5)

I did run several tests with BASS_StreamCreateFile. If I specify no speaker flags it works fine (just like BASS_StreamCreateFileUser) but if I try to set a speaker flag, such as BASS_SPEAKER_FRONTLEFT I get BASS_ERROR_SPEAKER.

So I guess the question is: how can I down-mix AAC to 1 channel...

Ian @ un4seen

Some decoders support the BASS_SAMPLE_MONO flag for downmixing to mono. That doesn't currently include BASS_AAC or Media Foundation, but here's a BASS update that adds support for it with Media Foundation on Windows 8 and above:

    www.un4seen.com/stuff/bass.zip

You should now be able to have AAC files downmixed to mono by using Media Foundation (with BASS_SAMPLE_MONO) instead of BASS_AAC to play them. A more universal (but also a bit more complex) option is to use the BASSmix add-on for downmixing, ie. plugging the decoder into a mono mixer with BASS_MIXER_CHAN_DOWNMIX set.