BASS for Universal Windows Platform (UWP)

Started by Ian @ un4seen,

Ian @ un4seen

It looks like the problem there is the "length" parameter of the BASS_MIDI_StreamCreateFile call, which is set to 1. That should usually be set to 0 (like in the BASS_StreamCreateFile call). Perhaps you meant to put that 1 in the "freq" parameter?

MARCO LESMES

Thank for your reply Ian, now is working and loading the midi file but I'm getting an error with the BassMidi.BASS_MIDI_FontInit function, I'm getting an BASS_ERROR_FILEOPEN:
bool init = Bass.BASS_Init(-1, 44100, BASSInit.BASS_DEVICE_DEFAULT, IntPtr.Zero);

string file = "C:\\Users\\Marco\\Music\\test.sf2";

BASS_MIDI_FONT[] newfonts = new BASS_MIDI_FONT[1];
Task.Run(() =>
{
    int font = BassMidi.BASS_MIDI_FontInit(file);
    if (font != 0)
    {
         newfonts[0] = new BASS_MIDI_FONT(font, 0, 0);
    }
    else
    {
        // error creating the font
        Debug.WriteLine("Font error: {0}", Bass.BASS_ErrorGetCode());
    }
}).Wait();

I'm can't see what I'm missing here...  ???

Ian @ un4seen

If the file definitely exists then perhaps it's a permission issue, ie. your app isn't allowed to access the file. Is your app able to open the file using normal file methods, eg. StorageFile.OpenAsync?

MARCOVLESMES

Hi Ian, I test to open the file without problem with the OpenAsync function:

string path = "C:\\Users\\Marco\\Music\\test.sf2";
var file = await StorageFile.GetFileFromPathAsync(path);
var fileStream = await file.OpenAsync(FileAccessMode.Read);
Debug.WriteLine(fileStream.CanRead); // Returns True
           
BASS_MIDI_FONT[] newfonts = new BASS_MIDI_FONT[1];
Task.Run(() =>
{
     int font = BassMidi.BASS_MIDI_FontInit(path);
     if (font != 0)
     {
          newfonts[0] = new BASS_MIDI_FONT(font, 0, 0);
     }
     else
     {
          // error creating the font
          Debug.WriteLine("Font error: {0}", Bass.BASS_ErrorGetCode()); // Return BASS_ERROR_FILEOPEN
     }
}).Wait();
Can be some thing else?

Ian @ un4seen

Ah, I think I know what it is now. StorageFile.OpenAsync is used to read the file but the latest BASSMIDI also has a soundfont timestamp check that's using normal C APIs. Here's an update for you to try with that timestamp check skipped (it assumes the file is unchanged):

   www.un4seen.com/stuff/bassmidi-uwp.zip

Let me know if the problem still happens with that.

MARCOVLESMES

Hi Ian, is everything working now with the updated version. Thank you for your assistance!  ;D

Ian @ un4seen

Great! The BASSMIDI update is now included in the package in the 1st post.

BassPassion

I am having some problems streaming AAC stream, such as
http://ic7.101.ru:8000/p450978
http://ic4.101.ru:8000/stream/pro/aac/64/23


I have tried with the supplied Netradio UWP example, it's also having problems playing these.
HTTP/1.0 200 OK is all that is reported , but then it seems to hang.

VLC plays them without problems.

Any ideas?


Ian @ un4seen

That problem was introduced in the Windows 20H1 update (see this thread). A fix has been added for the next BASS release, which should be coming in early 2021. In the meantime, here's the latest build for you to try:

   www.un4seen.com/stuff/bass-uwp.zip

Please let me know if you see the problem still happening with that.

BassPassion

Quote from: Ian @ un4seenThat problem was introduced in the Windows 20H1 update (see this thread). A fix has been added for the next BASS release, which should be coming in early 2021. In the meantime, here's the latest build for you to try:

   www.un4seen.com/stuff/bass-uwp.zip

Please let me know if you see the problem still happening with that.

Yes, this seems to work much better. Thank you very much.

MARCOVLESMES

Hi I'm try to use BASSEnc in a UWP app but when I try to get the library version I'm getting an Access Violation error my code is:
public async Task<int> GetBassEncVersion()
{
     int version = -1;
     Task.Run(() =>
     {
          version = BassEnc.BASS_Encode_GetVersion();
     }).Wait();

     return version;
}
The error is:
The program '[22396] MyApp.exe' has exited with code -1073741819 (0xc0000005) 'Access violation'.
Can you guide me to the right direction? Thanks!

Ian @ un4seen

Unfortunately, a UWP version of the BASSenc add-on isn't currently available (I guess you're trying to use the Win32 BASSENC.DLL?). The BASSenc add-on has a lot of platform-specific stuff, and UWP is unlike any of the existing supported platforms, so a port isn't straightforward.

Are you sure your app needs to be UWP? Perhaps it could be a regular "desktop" Windows app instead?

Andy09

Hi,

i have the following error: System.PlatformNotSupportedException: Marshalling arbitrary types is not supported.

First of all, i have called this:
_ReverbHandle = Bass.BASS_ChannelSetFX(_BassExInstance.Handle, BASSFXType.BASS_FX_DX8_REVERB, 1);

This works, and the effect is starting (i can hear this).
But if i call in the next line this:
Bass.BASS_FXSetParameters(_ReverbHandle, r);

then comes the error.

My enviroment: Visual Studio 2019, UWP App with .NET Standard Library and BASS.NET for Standard.

Andy

radio42

This is unfortunately not supported at runtime...due to the fact, in .Net Standard not all operations are supported, as 'Marshalling arbitrary types is not supported'.
So in order to remove that function (as it is supported in .Net Framework), I left it like it is.

Andy09

Quote from: radio42This is unfortunately not supported at runtime...due to the fact, in .Net Standard not all operations are supported, as 'Marshalling arbitrary types is not supported'.
So in order to remove that function (as it is supported in .Net Framework), I left it like it is.

Hi,
please do not get this wrong, but i guess this is not a problem with the runtime. I think is a problem with Bass.Net.Dll for .Net Standard. I have tested with Bass.Net.WinStore.dll and i have no issues with BASS_FXSetParameters and can set reverb parameters in my same library project (for .Net Standard 2.0).
And if i go back to Bass.Net.Dll (for Standard) i receive the error. And i wondering me, why works with Bass.Net.WinStore.dll and not with Bass.Net (Standard) in the same project? :-)

Andy

Ian @ un4seen

The UWP version of the BASS 2.4.16 release is up now in the 1st post.

Ian @ un4seen

The UWP version of the BASSHLS 2.4.3 release is up in the 1st post.

msitton

Any chance of getting BASSOPUS ported to UWP? I searched the thread and haven't seen any updates on it since the first post back in 2015.

Thanks!

Ian @ un4seen

Yep, a BASSOPUS port has now been added to the package in the 1st post, so please redownload to get that. Let me know if you have any trouble with it.

PandaSharp

Is it normal that when I call GetDeviceInfo method, the name property value is not really useful but is just "N", "D", "1", "H" instead of the soundcard name ... Is it a UWP limitation? here there is my code, I use managedbass c# wrapper

for (int i = 0; i < ManagedBass.Bass.DeviceCount; i++)
            {
                var device = ManagedBass.Bass.GetDeviceInfo(i);
                _deviceList.Add(device);
            }

thanks