Author Topic: Bass.net WinStore Error  (Read 165 times)

lokinfey

  • Posts: 4
Bass.net WinStore Error
« on: 7 Feb '17 - 00:28 »
I want to play music in my uwp project .

I import Bass.Net.WinStore

and add bass.dll

I try to add mp3 file

if (Bass.BASS_Init(-1, 44100, BASSInit.BASS_DEVICE_DEFAULT, IntPtr.Zero))
                    {
                        file = @" .....";
                        var stream = Bass.BASS_StreamCreateFile(file, 0L, 0L, BASSFlag.BASS_DEFAULT);  //Bass.BASS_StreamCreateFile(file, 0L, 0L, BASSFlag.BASS_DEFAULT);
                        if (stream != 0)
                        {
                            Bass.BASS_ChannelPlay(stream, false);

                        }

                    }

but it gave me

+      $exception   {System.Runtime.InteropServices.SEHException: External component has thrown an exception.
   at Un4seen.Bass.Bass.BASS_StreamCreateFileUnicode(Boolean mem, String file, Int64 offset, Int64 length, BASSFlag flags)
   at Un4seen.Bass.Bass.BASS_StreamCreateFile(String file, Int64 offset, Int64 length, BASSFlag flags)

Can you help me ?
« Last Edit: 7 Feb '17 - 00:40 by lokinfey »

pzs7602

  • Posts: 54
Re: Bass.net WinStore Error
« Reply #1 on: 7 Feb '17 - 02:16 »
Bass.BASS_StreamCreateFile must be called within Task.Run:

            Task.Run(() =>
            {
                 .....
            });