BASS for Universal Windows Platform (UWP)

Started by Ian @ un4seen,

Ian @ un4seen

An updated WinStore BASS version is up now in the 1st post, adding support for the BASS_CONFIG_DEV_DEFAULT option. It also improves handling of when a device's sample format is changed (via the Sound control panel) while the device is in use.

Ian @ un4seen

The WinStore version of the BASSMIDI 2.4.12 release is now up in the 1st post.

Ian @ un4seen

Support for the ARM64 architecture has been added to the packages in the 1st post (not BASS_FX yet). The BASSDSD/WV/mix add-ons have also been updated to the latest versions for all architectures.

The NETRADIO example has also been updated to the latest version of that. It also been changed to a Windows 10 (UWP) project, as Microsoft is phasing-out the Windows 8 and Windows Phone stores.

Ian @ un4seen

ARM64 support is now included in the BASS_FX add-on package in the 1st post.

Ian @ un4seen

The WinStore version of the BASS 2.4.14 release is up now in the 1st post.

Ian @ un4seen

The WinStore version of the BASSHLS 2.4.2 release is up now in the 1st post.

Pavan Tiwari

Hi Ian,

Un4seen.Bass.AddOn.HLS namespace is not available in WinStore library (Bass.Net.WinStore.dll)

Ian @ un4seen

The issue is (or at least was last I heard) that Microsoft require all libraries that are referenced to be included in a submitted app, even if the libraries aren't actually used. So the WinStore BASS.Net version doesn't reference any add-on that can be used via the plugin system (BASS_PluginLoad), which includes the BASSHLS add-on. BASS.Net does still include those add-ons' flag/tag/etc definitions, just not the functions.

Karl Lai

Hi, recently we have found a file that we cannot play with our app, which uses Bass.Net.WinStore.dll. The audio is an aac file. Questions:
1. Does BASS support aac on Windows 10?
2. If it does, can you help us figure out why we cannot play the file? The file is from an Alexa skill from Yahoo weather news, and I put it on my one drive:
https://1drv.ms/u/s!AnZQvguMsHKMjW7_U4NlGFq6NBTu

Thank you very much!

Ian @ un4seen

BASS can make use of the AAC decoder that comes with Windows 10, so your example file should be playable. Are you having the problem with only that AAC file or all AAC files? Are other file formats (eg. WAV or MP3) playing OK?

Karl Lai

It's just this file from Yahoo, but the same file can be played by other software like browser or windows media player. Our app can play other type without issue, so we are wondering if there is some special setting for this file that BASS cannot accept. We also tried to play it from the original URL and it's the same result.

Ian @ un4seen

Are you only having the problem with WinStore BASS version? If you haven't already done so, please try the Win32 version too (eg. one of the pre-compiled examples in the C\BIN folder) and see if that works.

laishiekai

#232
Thanks for the quick reply. This is Karl Lai and I registered an account to continue this discussion.

I tired the win32 sample project and it works for my file. I will look into the example codes to see what we are missing. In our code, we use BASS_StreamCreateFileUser for this file because we stream it from the service, maybe this is the root cause? Maybe I should use BASS_StreamCreateFile?

Update: I found that we can read other aac file with BASS_StreamCreateFileUser. And I also found that the bad file somehow doesn't hit end of stream. This might be why BASS return BASS_ERROR_FORMAT as error. But why BASS_StreamCreateFile (from the win32 example) can play it without issue?

laishiekai

This is the length that passed into the PROC function for the bad file:
512, 1536, 2048, 2048, 2048, 8192, 49152, 196608, 262144, 524288
Comparing to the working one, the first few chunks seems to be the metadata or header. But then after that it looks like the PROC function stopped before loading the full length. I am not familiar how AAC format manage the chunks, does it really have a bad format, or it's just we are not using the right flags for this format?

Our call is like this: (works for most of the file except the one above)
Bass.BASS_StreamCreateFileUser(BASSStreamSystem.STREAMFILE_BUFFER, BASSFlag.BASS_STREAM_AUTOFREE | BASSFlag.BASS_STREAM_BLOCK, STREAM_CALLBACKS, initializeStreamReadDataCallbackPointer);

Ian @ un4seen

I see what the problem is now. The file is actually an MP4 file and its "mdat" atom comes before its "moov" atom (basically the audio data comes before the description of it), which means it isn't streamable. It will be playable with BASS_StreamCreateFile or BASS_StreamCreateFileUser with system=STREAMFILE_NOBUFFER, but not BASS_StreamCreateURL or BASS_StreamCreateFileUser with system=STREAMFILE_BUFFER.

If you need to be able to stream that particular file, you can use MP4Box to fix it, like this: mp4box -isma <filename>

laishiekai

Quote from: Ian @ un4seenI see what the problem is now. The file is actually an MP4 file and its "mdat" atom comes before its "moov" atom (basically the audio data comes before the description of it), which means it isn't streamable. It will be playable with BASS_StreamCreateFile or BASS_StreamCreateFileUser with system=STREAMFILE_NOBUFFER, but not BASS_StreamCreateURL or BASS_StreamCreateFileUser with system=STREAMFILE_BUFFER.

If you need to be able to stream that particular file, you can use MP4Box to fix it, like this: mp4box -isma <filename>

Thank you very much for looking into this!!

Ian @ un4seen

The WinStore version of the BASS 2.4.15 release is up now in the 1st post. Note support for Windows Phone 8 has been removed (it was dropped by Microsoft a while ago).

Ian @ un4seen

The WinStore version of the BASSmix 2.4.10 release is up now in the 1st post.

Ian @ un4seen

The UWP version of the BASSMIDI 2.4.13 release is up now in the 1st post.

Note that Windows 8 support has now been dropped. Only UWP is supported and the packages have been renamed accordingly, eg. from "bass-winstore" to "bass-uwp".

MARCOVLESMES

Hi, I'm try to play a Midi File in a UWP app without success. I'm getting a BASS_ERROR_FILEFORM error with all the Midi files I have try... I try to load an MP3 file (with BASS_StreamCreateFile function) and it play without problem. My code is:
Task.Run(() =>
{
                stream = BassMidi.BASS_MIDI_StreamCreateFile(file, 0, 1, BASSFlag.BASS_DEFAULT, 0);
                // stream = Bass.BASS_StreamCreateFile(file, 0, 0, BASSFlag.BASS_DEFAULT); // Commented MP3 test
                if (stream != 0)
                {
                    // play the stream channel
                    Bass.BASS_ChannelPlay(stream, false);
                }
                else
                {
                    // error creating the stream
                    Debug.WriteLine("Stream error: {0}", Bass.BASS_ErrorGetCode());
                }
            }).Wait();

The files are in the same location, my Music folder. Appreciate your help