Author Topic: BASS for Windows Store/Phone  (Read 41181 times)

Ian @ un4seen

  • Administrator
  • Posts: 20600
Re: BASS for Windows Store/Phone
« Reply #175 on: 19 Oct '17 - 17:17 »
That depends on whether you're using the BASSHLS add-on :) ... It was updated to the latest version.

cablehead

  • Posts: 315
Re: BASS for Windows Store/Phone
« Reply #176 on: 21 Oct '17 - 14:06 »
If you need a working wavewriter - you can rip from this codeproject link. Works great:
https://www.codeproject.com/Articles/525620/Recording-audio-to-WAV-with-WASAPI-in-Windows-Stor

Ian @ un4seen

  • Administrator
  • Posts: 20600
Re: BASS for Windows Store/Phone
« Reply #177 on: 3 Jan '18 - 15:58 »
The Windows Store version of the BASS 2.4.13 release is now up in the 1st post.

fxfletch

  • Posts: 26
Re: BASS for Windows Store/Phone
« Reply #178 on: 4 Jan '18 - 22:19 »
Hi,

I am just starting a new project that is a Windows Universal App, I have downloaded all the latest stuff to use with the store and am trying a simple test:

if (Bass.BASS_Init(-1, 44100, BASSInit.BASS_DEVICE_DEFAULT, IntPtr.Zero))
            {
                // create a stream channel from a file
                int stream = Bass.BASS_StreamCreateFile("c:\\test.wav", 0, 0, BASSFlag.BASS_DEFAULT);
                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());
                }
            }

This exceptions on the stream create file method with:
System.Runtime.InteropServices.SEHException: 'External component has thrown an exception.'

Should it work with a Universal app?
Anything stupid I am doing wrong?

Ian

Ian @ un4seen

  • Administrator
  • Posts: 20600
Re: BASS for Windows Store/Phone
« Reply #179 on: 5 Jan '18 - 17:42 »
I don't think it is allowed for Windows Store apps to access the root C:\ folder. I get a Platform::AccessDeniedException when trying that here. Try putting the WAV file in your user "Music" folder (eg. "C:\Users\<username>\Music\") and playing it from there.

fxfletch

  • Posts: 26
Re: BASS for Windows Store/Phone
« Reply #180 on: 5 Jan '18 - 20:39 »
Thanks for the reply, I think its throwing the error before it even try's to access the file because I have tried moving it to different locations and also giving it a name that doesn't exist.
I always get this exception never any of the bass errors that I would expect if the file couldn't be found.

System.Runtime.InteropServices.SEHException occurred
  HResult=0x80004005
  Message=External component has thrown an exception.
  Source=<Cannot evaluate the exception source>
  StackTrace:
<Cannot evaluate the exception stack trace>

If I modify the code as below the first stream create all works its only when I try and create from a file that this happens.

                int stream1 = Bass.BASS_StreamCreate(44100,2, BASSFlag.BASS_SAMPLE_FLOAT, new BASSStreamProc()); // WORKS OKAY
                // create a stream channel from a file
                int stream = Bass.BASS_StreamCreateFile("C:\\Users\\Ian\\Music\\test.wav", 0, 0, BASSFlag.BASS_STREAM_DECODE | BASSFlag.BASS_SAMPLE_FLOAT); // EXCEPTION
                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());
                }

Ian
« Last Edit: 5 Jan '18 - 20:56 by fxfletch »

fxfletch

  • Posts: 26
Re: BASS for Windows Store/Phone
« Reply #181 on: 6 Jan '18 - 22:33 »
After hours of messing about I discovered that it works if I run it in a task, so my function to play a file and return the stream ID now looks like this:
Code: [Select]
public int PlayFile(string file)
        {
            int stream = -1;
            Task.Run(() =>
            {
                stream = Bass.BASS_StreamCreateFile(file, 0, 0, BASSFlag.BASS_DEFAULT);
                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();
            return stream;
        }

This works perfectly, note this is a windows universal app.

Ian @ un4seen

  • Administrator
  • Posts: 20600
Re: BASS for Windows Store/Phone
« Reply #182 on: 8 Jan '18 - 17:31 »
Oh, right. BASS_StreamCreateFile/URL calls do indeed need to be made asynchronously (not in the main thread) on Windows Store, as noted in the first post :)

Ian @ un4seen

  • Administrator
  • Posts: 20600
Re: BASS for Windows Store/Phone
« Reply #183 on: 12 Feb '18 - 16:42 »
The Windows Store versions of the BASS 2.4.13.8 and BASSHLS 2.4.1.1 releases are now up in the 1st post.

fxfletch

  • Posts: 26
Re: BASS for Windows Store/Phone
« Reply #184 on: 13 Feb '18 - 22:18 »
Hi,

Am I correct in thinking that ASIO is not available on a Windows Store app yet I am using bass.net and can't see any of the namespaces?

Ian

Ian @ un4seen

  • Administrator
  • Posts: 20600
Re: BASS for Windows Store/Phone
« Reply #185 on: 14 Feb '18 - 15:55 »
Yes, that is correct. I'm not sure it's possible to access ASIO drivers in Windows Store apps. Have you seen any Windows Store apps using ASIO?

fxfletch

  • Posts: 26
Re: BASS for Windows Store/Phone
« Reply #186 on: 14 Feb '18 - 16:02 »
I have seen at least one https://www.microsoft.com/store/productId/9NV01LCVXF1B

Claims to do ASIO

Ian @ un4seen

  • Administrator
  • Posts: 20600
Re: BASS for Windows Store/Phone
« Reply #187 on: 15 Feb '18 - 18:05 »
I believe that app is actually using BASSASIO, and is using normal Windows APIs (Win32) rather than Windows Store APIs (Universal Windows Platform).

fxfletch

  • Posts: 26
Re: BASS for Windows Store/Phone
« Reply #188 on: 15 Feb '18 - 18:41 »
Ah so I might be misunderstanding something about the windows store version of the APIs. I thought I had to use those in order to be able to submit an app to the store. But that's obviously not the case.

Is this more about the fact that I am developing a UWP app? I thought I had no choice if I wanted to submit to the store, but perhaps I need to do a bit more research.

Ian

Ian @ un4seen

  • Administrator
  • Posts: 20600
Re: BASS for Windows Store/Phone
« Reply #189 on: 16 Feb '18 - 15:48 »
Yeah, with all the different names/changes, it's a bit confusing. I think what was once called a "Windows Store app" is now a "Universal Windows Platform app". But then there are Windows 8 and Windows Phone 8 apps, which aren't UWP, so who knows :)

Anyway, Win32 apps can now be packaged in a way for Windows Store, using this:

   https://docs.microsoft.com/en-us/windows/uwp/porting/desktop-to-uwp-run-desktop-app-converter

fxfletch

  • Posts: 26
Re: BASS for Windows Store/Phone
« Reply #190 on: 17 Feb '18 - 11:59 »
Thanks,

Yes I was looking at that but unfortunately I am taking advantage of some of the UWP features that wouldn't be available if I did that. Basically the only reason I wanted to use ASIO is to access the additional output channels available on professional sound cards. I think I will have to recommend that any customers that want to do that use an external driver that can expose a multi channel ASIO device as virtual sound cards.

Ian