Author Topic: BASS for WinCE  (Read 378734 times)

Ian @ un4seen

  • Administrator
  • Posts: 26266
Re: BASS for WinCE
« Reply #325 on: 25 Jun '21 - 14:56 »
The Windows CE version of the BASS 2.4.16 release is up now in the 1st post.

Ian @ un4seen

  • Administrator
  • Posts: 26266
Re: BASS for WinCE
« Reply #326 on: 15 Jul '21 - 13:10 »
The Windows CE version of the BASSOPUS 2.4.2 release is up in the 1st post.

Ian @ un4seen

  • Administrator
  • Posts: 26266
Re: BASS for WinCE
« Reply #327 on: 10 May '22 - 17:40 »
The Windows CE version of the BASSMIDI 2.4.14 release is up in the 1st post.

Serhii

  • Posts: 6
Re: BASS for WinCE
« Reply #328 on: 27 Oct '22 - 07:10 »
Good afternoon
I'm trying to compile under WinCe InetRadio, an error pops up: "bass.pas(732,1) Fatal: Syntax error, "identifier" expected but "FUNCTION" found". Error: function BASS_SetConfig(option, value: DWORD): BOOL; {$IFDEF MSWINDOWS}stdcall{$ELSE}cdecl{$ENDIF}; external bassdll;
Everything works under win32.

unit Unit1;

{$mode objfpc}{$H+}

interface

uses
  Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls,
  ExtCtrls, Buttons, Bass;

type

  { TForm1 }

  TForm1 = class(TForm)
    BitBtn1: TBitBtn;
    BitBtn10: TBitBtn;
    BitBtn11: TBitBtn;
    BitBtn12: TBitBtn;
    BitBtn13: TBitBtn;
    BitBtn14: TBitBtn;
    BitBtn15: TBitBtn;
    BitBtn16: TBitBtn;
    BitBtn17: TBitBtn;
    BitBtn18: TBitBtn;
    BitBtn19: TBitBtn;
    BitBtn2: TBitBtn;
    BitBtn20: TBitBtn;
    BitBtn21: TBitBtn;
    BitBtn22: TBitBtn;
    BitBtn23: TBitBtn;
    BitBtn24: TBitBtn;
    BitBtn3: TBitBtn;
    BitBtn4: TBitBtn;
    BitBtn5: TBitBtn;
    BitBtn6: TBitBtn;
    BitBtn7: TBitBtn;
    BitBtn8: TBitBtn;
    BitBtn9: TBitBtn;
    Button2: TButton;
    Button3: TButton;
    Fallout: TImage;
    Image2: TImage;
    Image3: TImage;
    Image4: TImage;
    Image5: TImage;
    Stop: TButton;
    procedure BitBtn10Click(Sender: TObject);
    procedure BitBtn11Click(Sender: TObject);
    procedure BitBtn12Click(Sender: TObject);
    procedure BitBtn13Click(Sender: TObject);
    procedure BitBtn14Click(Sender: TObject);
    procedure BitBtn15Click(Sender: TObject);
    procedure BitBtn16Click(Sender: TObject);
    procedure BitBtn17Click(Sender: TObject);
    procedure BitBtn18Click(Sender: TObject);
    procedure BitBtn19Click(Sender: TObject);
    procedure BitBtn1Click(Sender: TObject);
    procedure BitBtn20Click(Sender: TObject);
    procedure BitBtn21Click(Sender: TObject);
    procedure BitBtn22Click(Sender: TObject);
    procedure BitBtn23Click(Sender: TObject);
    procedure BitBtn24Click(Sender: TObject);
    procedure BitBtn2Click(Sender: TObject);
    procedure BitBtn3Click(Sender: TObject);
    procedure BitBtn4Click(Sender: TObject);
    procedure BitBtn5Click(Sender: TObject);
    procedure BitBtn6Click(Sender: TObject);
    procedure BitBtn7Click(Sender: TObject);
    procedure BitBtn8Click(Sender: TObject);
    procedure BitBtn9Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
    procedure Button3Click(Sender: TObject);
    procedure FormCreate(Sender: TObject);
    procedure StopClick(Sender: TObject);

  end;

var
  Form1: TForm1;


implementation


 var
  url_radio: HSTREAM;

{$R *.lfm}

{ TForm1 }

procedure TForm1.FormCreate(Sender: TObject);
begin
  BASS_CONFIG_DEV_BUFFER();
  BASS_Init(-1,44100,0,Handle,nil);
  BASS_SetConfig(BASS_CONFIG_NET_PLAYLIST, 1);
  BASS_SetConfig(BASS_CONFIG_NET_PREBUF, 0);

end;



procedure TForm1.StopClick(Sender: TObject);
begin
  BASS_ChannelStop(url_radio);
  BASS_StreamFree(url_radio);
  url_radio:=0;
end;



procedure TForm1.BitBtn10Click(Sender: TObject);
var
    url1:string;
begin
  try
  url1:='http://listen.42fm.ru:8000/stealkill-128';
  BASS_StreamFree(url_radio);
  BASS_ChannelSetAttribute(url_radio, BASS_ATTRIB_VOL, 100);
  url_radio := BASS_StreamCreateURL(PChar(url1), 0, BASS_STREAM_BLOCK or BASS_STREAM_STATUS or BASS_STREAM_AUTOFREE, nil, nil);
  BASS_ChannelPlay(url_radio,False);

  except
    on e:Exception do
   end;

end;

Tell me what's the problem?

JKD

  • Posts: 2
Re: BASS for WinCE
« Reply #329 on: 11 Dec '23 - 04:41 »
Hello,
I'm testing the latest supported bass.dll in WinCe 6 (emulator) and Wince 7 (device) which use ARM32. In both enviroments I'm getting BASS_ERROR_NONET error (32) using BASS_StreamCreateURL while network is enabled. Other applications can establish communication without problem. I've tested netradio demo getting the same error.

What steps does bass.dll perform to get that error? If there's no more support for WinCE, could it be possible to get that library source code to adapt it to the peculiarities of this obsolete operating system?

Ian @ un4seen

  • Administrator
  • Posts: 26266
Re: BASS for WinCE
« Reply #330 on: 11 Dec '23 - 13:51 »
BASS uses WinInet for internet access and will fail with BASS_ERROR_NONET when that (wininet.dll) can't be loaded (or if InternetOpen fails), so perhaps it isn't included in your WinCE versions?

JKD

  • Posts: 2
Re: BASS for WinCE
« Reply #331 on: 11 Dec '23 - 14:37 »
Wininet.dll exists at windows folder both in emulator and device. I've made a simple application to test InternetOpenW:
Code: [Select]
DWORD accesstype = INTERNET_HANDLE_TYPE_INTERNET;
WCHAR *proxy = NULL;
WCHAR *useragent=L"Test";
HINTERNET hi = InternetOpenW(useragent, accesstype, proxy, 0, 0);

Debugging indicates that the variable hi contains a handle other than NULL so in my test, InternetOpenW works  ???

Ian @ un4seen

  • Administrator
  • Posts: 26266
Re: BASS for WinCE
« Reply #332 on: 11 Dec '23 - 15:09 »
That's strange then. With default settings, the InternetOpen call will look like this:

Code: [Select]
HINTERNET hi = InternetOpenW(L"BASS/2.4", INTERNET_OPEN_TYPE_PRECONFIG, 0, 0, 0);

Do you still get a non-0 return value when trying that yourself? The only other time a BASS_ERROR_NONET error may occur is if the file request fails and InternetGetConnectedState fails too, so you could also check that.

alex.s

  • Posts: 4
Re: BASS for WinCE
« Reply #333 on: 13 Nov '24 - 08:03 »
Hello everyone!
Can anybody please share the link to actual version of BASS.NET CE for .Net CompactFramework?
This link www.un4seen.com/filez/4/Bass24.Net_compact.zip on the first page is damaged...

Thanks!

P.S. Googling has no results...

Ian @ un4seen

  • Administrator
  • Posts: 26266
Re: BASS for WinCE
« Reply #334 on: 13 Nov '24 - 14:17 »
That was discontinued quite a while ago. I think the last release was 2.4.12, but the latest version we're able to find right now is 2.4.11.1 (perhaps a user will pop-up with 2.4.12). I've put that up at the link above. Of course, it's missing support for stuff that's been added to BASS/add-ons since then, but hopefully it'll still work for you.

alex.s

  • Posts: 4
Re: BASS for WinCE
« Reply #335 on: 13 Nov '24 - 16:27 »
That was discontinued quite a while ago. I think the last release was 2.4.12, but the latest version we're able to find right now is 2.4.11.1 (perhaps a user will pop-up with 2.4.12). I've put that up at the link above. Of course, it's missing support for stuff that's been added to BASS/add-ons since then, but hopefully it'll still work for you.
Thank you so much!
I try to develop small mp3 player for some old device under winCE 6.0 R3 with .net compact framework 3.5
The Windows CE version of the BASS.DLL 2.4.16
bass.dll and Bass.Net.compact.dll are located near .exe file
Reference to Bass.Net.compact.dll was specified in the project.

And... got a problem with code like this:
Code: [Select]
using Un4seen.Bass;
private void Form1_Load(object sender, EventArgs e)
{
    Bass.BASS_Init(-1, 44100, BASSInit.BASS_DEVICE_DEFAULT, this.Handle);
}
It's throws an exception TypeLoadException
not only Bass.BASS_Init() but any call to Bass.BASS_xxx  do the same...

But... this code works fine:
Code: [Select]
[DllImport("bass", CharSet = CharSet.Auto)]
private static extern bool BASS_Init(int device, int freq, int flags, IntPtr hwnd, IntPtr clsid);

private void Form1_Load(object sender, EventArgs e)
{
   BASS_Init(-1, 44100, 0, this.Handle, IntPtr.Zero);
}

What am I doing wrong?
Maybe it's incompartible versions? bass ce 2.4.16 and bass.net.compact 2.4.11.1 ?
« Last Edit: 14 Nov '24 - 03:06 by alex.s »

Ian @ un4seen

  • Administrator
  • Posts: 26266
Re: BASS for WinCE
« Reply #336 on: 13 Nov '24 - 17:23 »
It's throws an exception TypeLoadException

I think that means it's unable to find/load either BASS.NET.COMPACT.DLL or BASS.DLL. Have both been deployed to the same folder as your EXE on the device, ie. you can see them there?

alex.s

  • Posts: 4
Re: BASS for WinCE
« Reply #337 on: 14 Nov '24 - 02:25 »
Have both been deployed to the same folder as your EXE on the device, ie. you can see them there?

That's right. I see them both. Strictly speaking not on phisical device but on the emulator.
They are automatically deployed by VS to the BIN\Release folder because they are included in the project.

Background is:
First I used the [DIIImport] attribute and everything was fine until I called BASS_ChannelGetLength.
This resulted same problem as in https://www.un4seen.com/forum/?topic=9534.msg79692#msg79692
So i start looking solutions for compact framework.
« Last Edit: 14 Nov '24 - 02:57 by alex.s »

Ian @ un4seen

  • Administrator
  • Posts: 26266
Re: BASS for WinCE
« Reply #338 on: 14 Nov '24 - 16:50 »
If you are able to use BASS.DLL via DllImport then I guess that means it's the BASS.NET.COMPACT.DLL file that can't be found/loaded for some reason. As Bernd mentioned in that linked thread, the .Net compact framework apparently only supports 32-bit integer return values from native code, so BASS.DLL included special versions of some functions (including BASS_ChannelGetLength) for BASS.NET.COMPACT.DLL to use:

Code: [Select]
void WINAPI BASS_GetCPU_(float *result);
void WINAPI BASS_GetVolume_(float *result);
void WINAPI BASS_StreamGetFilePosition_(HSTREAM handle, DWORD mode, QWORD *result);
void WINAPI BASS_ChannelBytes2Seconds_(DWORD handle, QWORD pos, double *result);
void WINAPI BASS_ChannelSeconds2Bytes_(DWORD handle, double pos, QWORD *result);
void WINAPI BASS_ChannelGetLength_(DWORD handle, DWORD mode, QWORD *result);
void WINAPI BASS_ChannelGetPosition_(DWORD handle, DWORD mode, QWORD *result);

Perhaps you can use them directly via DllImport.

alex.s

  • Posts: 4
Re: BASS for WinCE
« Reply #339 on: 15 Nov '24 - 03:56 »
Perhaps you can use them directly via DllImport.

Oh, thanks!
If it works, it's more than enough for me.

jhonny

  • Posts: 3
Re: BASS for WinCE
« Reply #340 on: 2 Feb '25 - 04:26 »
Hello, I'm trying the latest version of bass.dll in my Windows Embedded 7 but it doesn't seem possible to listen to any streaming server.

To see if the problem is related to the network and not the library, I have enabled debugging messages for the wininet.dll library and tested the netradio application. It caught my attention that, although there is a connection to the streaming server (calls to InternetConnectW and HttpOpenRequestW return a handle so they are correct), the HttpSendRequestW call shows weird data after "Icy-MetaData: 1\r".

Example:
Code: [Select]
00:18:56.159 0758618e:<app> 001 HttpSendRequestW(0xcc000c, "Icy-MetaData: 1\r???????????", 28, 0x0, 0)

This affects subsequent calls inside HttpSendRequestW, such as:
Code: [Select]
00:18:56.159 0758618e:<app> 002   HttpWrapSendRequest(0xcc000c, "Icy-MetaData: 1\r猊捩污瀮湐퐜䏝桔摲憎ݘ", 49, 0x0, 0, 0)
00:18:56.165 0758618e:<app> 004       HttpAddRequestHeadersA(0xcc000c, "Icy-MetaData: 1\r猊捩污瀮湐퐜䏝桔摲憎ݘ", 49, 0xa0000000)
00:18:56.167 0758618e:<app> 005         wHttpAddRequestHeaders(0x38da0, 0x37fa0 ["Icy-MetaData: 1\r猊捩污瀮湐퐜䏝桔摲憎ݘ"], 49, 0xa0000000)
00:18:56.171 0758618e:<app> 006           ReplaceHeader("猊捩污瀮湐퐜䏝桔摲憎ݘ", 33, "", 0, 0, 0xa0000000)

That call to ReplaceHeader returns the next error:
Code: [Select]
00:18:56.171 0758618e:<app> 006           ReplaceHeader() returning 12150 [ERROR_HTTP_HEADER_NOT_FOUND]

So, wHttpAddRequestHeaders, HttpAddRequestHeadersA and HttpWrapSendRequest return the same error and HttpSendRequestW returns FALSE.

Is bass library passing the right string and size arguments to HttpSendRequestW?


Ian @ un4seen

  • Administrator
  • Posts: 26266
Re: BASS for WinCE
« Reply #341 on: 3 Feb '25 - 12:54 »
Oops, it looks like there's a bug in the latest/last WinCE build when custom headers aren't provided. To confirm that, please try adding a custom header and see whether it works then. For example:

Code: [Select]
stream = BASS_StreamCreateURL("http://host.com/path\r\nblah:blah\r\n", 0, 0, 0, 0);

jhonny

  • Posts: 3
Re: BASS for WinCE
« Reply #342 on: 3 Feb '25 - 17:39 »
Oops, it looks like there's a bug in the latest/last WinCE build when custom headers aren't provided. To confirm that, please try adding a custom header and see whether it works then. For example:

Code: [Select]
stream = BASS_StreamCreateURL("http://host.com/path\r\nblah:blah\r\n", 0, 0, 0, 0);

I've tried these three cases:

case 1: stream = BASS_StreamCreateURL("http://rautemusik.stream39.radiohost.de/lounge?_art=dD0xNzM4NTk3NjY4JmQ9YmEzODM0ZTAwYjYyYTNjMTdlNGE\r\nblah:blah\r\n", 0, 0, 0, 0);
Code: [Select]
00:01:48.663 061039fa:<app> 001 HttpSendRequestW(0xcc000c, "Icy-MetaData: 1\r\nConnection: close\r\nblah:blah\r\n", 47, 0x0, 0)
00:01:48.665 061039fa:<app> 002   HttpWrapSendRequest(0xcc000c, "Icy-MetaData: 1\r\nConnection: close\r\nblah:blah\r\n", 47, 0x0, 0, 0)
00:01:49.548 061039fa:<app> 001 HttpSendRequestW() returning TRUE

case 2: stream = BASS_StreamCreateURL("http://rautemusik.stream39.radiohost.de/lounge?_art=dD0xNzM4NTk3NjY4JmQ9YmEzODM0ZTAwYjYyYTNjMTdlNGE", 0, 0, 0, 0);
Code: [Select]
00:01:38.970 068438c2:<app> 001 HttpSendRequestW(0xcc000c, "Icy-MetaData: 1\r??????????????????????????", 42, 0x0, 0)
00:01:38.972 068438c2:<app> 002   HttpWrapSendRequest(0xcc000c, "Icy-MetaData: 1\r愊瑲搜い乞䵺䞎歔䞳奪䚎六倹䕭䜺䵄嚰䅔奷奪å...", 94, 0x0, 0, 0)
00:01:38.988 068438c2:<app> 004       HttpAddRequestHeadersA(0xcc000c, "Icy-MetaData: 1\r愊瑲搜い乞䵺䞎歔䞳奪䚎六倹䕭䜺䵄嚰䅔奷奪å...", 94, 0xa0000000)
00:01:38.991 068438c2:<app> 005         wHttpAddRequestHeaders(0x5b0f0, 0x5bb50 ["Icy-MetaData: 1\r愊瑲搜い乞䵺䞎歔䞳奪䚎六倹䕭䜺䵄嚰䅔奷奪å..."], 94, 0xa0000000)
00:01:39.003 068438c2:<app> 006           ReplaceHeader("愊瑲搜い乞䵺䞎歔䞳奪䚎六倹䕭䜺䵄嚰䅔奷奪她乔䵪摔乬䕇", 78, "", 0, 0, 0xa0000000)
00:01:39.011 068438c2:<app> 006           ReplaceHeader() returning 12150 [ERROR_HTTP_HEADER_NOT_FOUND]
00:01:39.012 068438c2:<app> 005         wHttpAddRequestHeaders() returning 12150 [ERROR_HTTP_HEADER_NOT_FOUND]
00:01:39.015 068438c2:<app> 004         HttpAddRequestHeadersA() returning 12150 [ERROR_HTTP_HEADER_NOT_FOUND]
00:01:39.018 068438c2:<app> 004       HttpAddRequestHeadersA() returning FALSE
00:01:39.018 068438c2:<app> 003     HTTP_REQUEST_HANDLE_OBJECT::InitBeginSendRequest() returning 12150 [ERROR_HTTP_HEADER_NOT_FOUND]
00:01:39.021 068438c2:<app> 002     HttpWrapSendRequest() returning 12150 [ERROR_HTTP_HEADER_NOT_FOUND]
00:01:39.021 068438c2:<app> 002   HttpWrapSendRequest() returning FALSE
00:01:39.021 068438c2:<app> 001 HttpSendRequestW() returning FALSE

case 3: stream = BASS_StreamCreateURL("http://rautemusik.stream39.radiohost.de/lounge?_art=dD0xNzM4NTk3NjY4JmQ9YmEzODM0ZTAwYjYyYTNjMTdlNGE\r\n", 0, 0, 0, 0);
Code: [Select]
00:03:22.437 0789917e:<app> 001 HttpSendRequestW(0xcc000c, "Icy-MetaData: 1\r\nConnection: close\r\n", 36, 0x0, 0)
00:03:22.440 0789917e:<app> 002   HttpWrapSendRequest(0xcc000c, "Icy-MetaData: 1\r\nConnection: close\r\n", 36, 0x0, 0, 0)
00:03:22.476 0789917e:<app> 003     HTTP_REQUEST_HANDLE_OBJECT::InitBeginSendRequest() returning 0 [ERROR_SUCCESS]
00:03:23.526 0789917e:<app> 002   HttpWrapSendRequest() returning TRUE
00:03:23.526 0789917e:<app> 001 HttpSendRequestW() returning TRUE

The second case is failing.

Ian @ un4seen

  • Administrator
  • Posts: 26266
Re: BASS for WinCE
« Reply #343 on: 4 Feb '25 - 17:46 »
Ah yes, appending only "\r\n" is an even better solution, as it enables the custom headers code path without actually sending any custom headers.

I've now put an updated BASS build in the first post, which should fix the problem without needing to enable custom headers, so please re-download and see if you still have the problem with that. It's actually a BASS 2.4.17 build, so also adds support for the BASS 2.4.17 features (the previous build was 2.4.16).

jhonny

  • Posts: 3
Re: BASS for WinCE
« Reply #344 on: 6 Feb '25 - 06:48 »
... so please re-download and see if you still have the problem with that.

It's working now  ;)