Author Topic: BASS(Android) and Delphi XE5  (Read 43042 times)

chensx2014

  • Posts: 1
Re: BASS(Android) and Delphi XE5
« Reply #25 on: 24 Jan '14 - 04:28 »
I successfully connected to a BASS cast server (my app.) from an Android Delphi XE5 app. through LAN (with unicode URL string). :)
Could you please share the code? I am stuck in getting bass working in Delphi XE5 Android.

3delite

  • Posts: 933
Re: BASS(Android) and Delphi XE5
« Reply #26 on: 24 Jan '14 - 20:11 »
Using BASS Android with Delphi XE5:

Here's an Android BASS unit: http://www.3delite.hu/Object%20Pascal%20Developer%20Resources/Download/BASSFunctions.pas
Not all BASS functions have been added, you have to extend it if you need a function not implemented.

Usage: Call LoadBASS and LoadBASSPlugins on program startup.

To include the BASS files for your app.:
1. In Delphi menu: Project/Deployment
2. 2nd icon from the left: Add files, select the used BASS files (libbass.so etc.)
3. Select the added BASS file and click the last icon (Change remote path for selected items)
4. Enter: 'library\lib\armeabi'

That's all.

Turlin

  • Posts: 4
Re: BASS(Android) and Delphi XE5
« Reply #27 on: 25 Jan '14 - 18:12 »
Thanks 3delite!

I managed to connect a stream but when I "BASS_ChannelGetTags (Chan, BASS_TAG_META)," alone with Oriental characters.
I tried to use AnsiToUTF8, UTF8ToAnsi, Utf8tostring, Utf8toWidesting, Utf8toUnicode, and more conversions, but I did not get any results, any ideas?

Thank for the help!!!
« Last Edit: 25 Jan '14 - 19:26 by Turlin »

Chris

  • Posts: 1884
Re: BASS(Android) and Delphi XE5
« Reply #28 on: 25 Jan '14 - 21:31 »
Code: [Select]
var
 Meta:PChar;
begin
   Meta:= PByte2String(BASS_ChannelGetTags (Chan, BASS_TAG_META));
end:
« Last Edit: 25 Jan '14 - 21:36 by Chris »

Turlin

  • Posts: 4
Re: BASS(Android) and Delphi XE5
« Reply #29 on: 29 Jan '14 - 16:06 »
Code: [Select]
var
 Meta:PChar;
begin
   Meta:= PByte2String(BASS_ChannelGetTags (Chan, BASS_TAG_META));
end:

PByte2String????

I donīt now this function, is a personal function???

Ionut Cristea

  • Posts: 1558
Re: BASS(Android) and Delphi XE5
« Reply #30 on: 29 Jan '14 - 16:08 »
Is a function from BASS header a user posted here :)

Chris

  • Posts: 1884
Re: BASS(Android) and Delphi XE5
« Reply #31 on: 29 Jan '14 - 17:45 »
About the Pbyte2String. The Problem is that Delphimobile(for Android) don`t know (P)Ansistrings so you have to cast all PAnsistrings to PByte and then convert them back to WideString.
For that is the function  PByte2String.
« Last Edit: 30 Jan '14 - 01:14 by Chris »

Turlin

  • Posts: 4
Re: BASS(Android) and Delphi XE5
« Reply #32 on: 29 Jan '14 - 20:54 »
Ok thanks...!!!  I will try it :)

ivanivan

  • Guest
Re: BASS(Android) and Delphi XE5
« Reply #33 on: 12 Feb '14 - 16:13 »
please help give the project internet radio for android delphi xe 5 here is my code that is wrong with him does not give error but does not play
unit Unit1;

interface

uses
  System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants,
  FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics,System.iOUtils, FMX.Dialogs,
  FMX.StdCtrls, FMX.Layouts, FMX.Memo,BASSFunctions;

type
  TForm1 = class(TForm)
    Button1: TButton;
    Label1: TLabel;
    procedure Button1Click(Sender: TObject);
    procedure FormCreate(Sender: TObject);


  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1; BASSLibraryHandle: THandle;
  uStream:HSTREAM;DocDir: string;
    BASSMixLibraryHandle: THandle;
    BASSFXLibraryHandle: THandle;
implementation

{$R *.fmx}

procedure TForm1.Button1Click(Sender: TObject);
begin uStream:=BASS_StreamCreateURL(Pchar('http://retro32.streamr.ru'),0,BASS_STREAM_STATUS,nil,0);
BASS_ChannelPlay(uStream,True); if not bass_channelplay(ustream,true) then label1.text:='not' else label1.Text:='yes';end;

procedure TForm1.FormCreate(Sender: TObject);
begin  DocDir := IncludeTrailingPathDelimiter(System.IOUtils.TPath.GetLibraryPath);
BASSLibraryHandle := LoadLibrary(PChar(DocDir + 'libbass.so')); Loadbass;  BASS_Init(-1,44100,0,Handle,nil);
end;

end.

Chris

  • Posts: 1884
Re: BASS(Android) and Delphi XE5
« Reply #34 on: 12 Feb '14 - 17:39 »
please help give the project internet radio for android delphi xe 5 here is my code that is wrong with him does not give error but does not play
.

try this

Code: [Select]
unit Unit1;

interface

uses
  System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants,
  FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics,System.iOUtils, FMX.Dialogs,
  FMX.StdCtrls, FMX.Layouts, FMX.Memo,BASSFunctions;

type
  TForm1 = class(TForm)
    Button1: TButton;
    Label1: TLabel;
    procedure Button1Click(Sender: TObject);
    procedure FormCreate(Sender: TObject);


  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;
  //BASSLibraryHandle: THandle; not needed
  uStream:HSTREAM;
  //DocDir: string;  not needed
  //BASSMixLibraryHandle: THandle;  not needed
  //BASSFXLibraryHandle: THandle;  not needed
implementation

{$R *.fmx}

procedure TForm1.Button1Click(Sender: TObject);
begin
   uStream:=BASS_StreamCreateURL(Pchar('http://retroserver.streamr.ru:8043/retro128'),0,BASS_STREAM_STATUS or BASS_UNICODE,nil,nil);
   if uStream = 0 then // Error
   ShowMessage('Stream was not created Errorcode= '+inttostr(Bass_ErrorGetCode());

   if not Bass_ChannelPlay(ustream,true) then
   begin
      label1.text:='not';
       ShowMessage('Cannot Play The Stream Errorcode= '+inttostr(Bass_ErrorGetCode());
      end
      else
        label1.Text:='yes';
end;

procedure TForm1.FormCreate(Sender: TObject);
begin  
   // DocDir := IncludeTrailingPathDelimiter(System.IOUtils.TPath.GetLibraryPath); // not needed is included inside the LoadBass Call
   // BASSLibraryHandle := LoadLibrary(PChar(DocDir + 'libbass.so')); // not needed is included inside the LoadBass Call
   // be shure that you have copy the right (x86 or x64) Lib to your lib path
    Loadbass;
    BASS_Init(-1,44100,0,Handle,nil);
end;

end.

by the way xe5 mobile is unicode so in Bass_StreamCreateurl you have to place as Flag Bass_Unicode
« Last Edit: 12 Feb '14 - 17:57 by Chris »

ivanivan471

  • Posts: 3
Re: BASS(Android) and Delphi XE5
« Reply #35 on: 22 Feb '14 - 08:55 »
Thank you for help. More help that this code is not the
  procedure TForm1.Button3Click (Sender: TObject);

begin
  Meta: = PByte2String (BASS_ChannelGetTags (ustream, BASS_TAG_META));
   if (meta <> '') then
   begin
     p: = Pos ('StreamTitle =', pwidechar (pwidechar (meta)));
     if (p = 0) then
       Exit;
     p: = p + 13;
     meta: = pChar (PWideChar (Copy (meta, p, Pos (';', PWideChar (meta)) - p - 1))) ;

   end; Label1.text: = UTF8Decode (meta); end;
« Last Edit: 11 Mar '14 - 12:53 by ivanivan471 »

ivanivan

  • Guest
Re: BASS(Android) and Delphi XE5
« Reply #36 on: 3 Mar '14 - 15:13 »
Hi how to make that meta Cyrillic ??? ??? ???

yassinov

  • Posts: 2
Re: BASS(Android) and Delphi XE5
« Reply #37 on: 4 Mar '14 - 23:30 »
We look for more features in "BASSFunctions" for XE5 !
any solution or updates in BassFunctions unit to use volume control , Flanger and Reverd audio effects ?

ivanivan471

  • Posts: 3
Re: BASS(Android) and Delphi XE5
« Reply #38 on: 11 Mar '14 - 12:50 »
In BASSFunctions.pas me were added to the following functions:
BASS_SampleSetData
BASS_SampleFree
BASS_SampleCreate
BASS_SampleLoad
BASS_GetEAXParameters
BASS_SetEAXParameters
BASS_Apply3D
BASS_Get3DPosition
BASS_Set3DPosition
BASS_Get3DFactors
BASS_Set3DFactors
BASS_PluginGetInfo
BASS_PluginFree
BASS_GetVolume
BASS_SetVolume
BASS_Pause
BASS_Start
BASS_Update
BASS_GetInfo
BASS_GetDSoundObject
BASS_SetDevice
BASS_GetVersion
BASS_GetConfigPtr
BASS_SetConfigPtr
 8) 8) 8) 8) 8) 8) 8)
help me how to make Cyrillic a meta ???

Hackbart

  • Posts: 2
Re: BASS(Android) and Delphi XE5
« Reply #39 on: 18 Mar '14 - 11:47 »
The attached sample contain the whole bass.pas for Android/iOS and Windows, plus a simple sample how to integrate it in firemonkey.

Christian

ivanivan471

  • Posts: 3
Re: BASS(Android) and Delphi XE5
« Reply #40 on: 15 Apr '14 - 09:54 »
Hi, someone has a module bass_fx?
Put please.

Re: BASS(Android) and Delphi XE5
« Reply #41 on: 5 Jun '14 - 11:57 »
Hi all,

we have the following code:

/* no error here */
stream := BASS_StreamCreatefile(false, Pchar(filename), 0, 0, BASS_STREAM_DECODE or BASS_STREAM_STATUS or BASS_UNICODE);
stream := BASS_FX_TempoCreate(stream, BASS_FX_FREESOURCE);

/* but here the application freezes */
Bass_ChannelPlay(stream, true);

If we omit the BASS_STREAM_DECODE parameters, no error but without FX :-(:

stream := BASS_StreamCreatefile(false, Pchar(filename), 0, 0,  BASS_STREAM_STATUS or BASS_UNICODE);
Bass_ChannelPlay(stream, true);

Any suggestions?

Thanx in advance.

Ciao.
L.

Chris

  • Posts: 1884
Re: BASS(Android) and Delphi XE5
« Reply #42 on: 5 Jun '14 - 18:07 »
do you you did a BASS_FX_GetVersion call at your OnFormCreate?
by the way a better way of your code should be

Code: [Select]
stream := BASS_StreamCreatefile(false, Pchar(filename), 0, 0, BASS_STREAM_DECODE or BASS_UNICODE);// Bass_Stream_Status is for URl Stream Stuff (shoutcast/icecast an co)
if stream <> 0 then
stream := BASS_FX_TempoCreate(stream, BASS_FX_FREESOURCE)
else
 // something wrong so lets check //errorcode handling..e.g Bass_ErrorGetCode .......

/* but here the application freezes */
if not Bass_ChannelPlay(stream, false);// makes no sense to restart a new created stream
then
// errorcode handling

« Last Edit: 5 Jun '14 - 18:10 by Chris »

Re: BASS(Android) and Delphi XE5
« Reply #43 on: 5 Jun '14 - 19:11 »
Thanks, but i've tried your corrections.. nothing happen. freezes.
I've also inserted
ShowMessage( intToStr (BASS_FX_GetVersion) );
freezes also, this only in Adroid, when i complile in Win32 exe works great all.

Chris

  • Posts: 1884
Re: BASS(Android) and Delphi XE5
« Reply #44 on: 5 Jun '14 - 21:25 »
can you please show more code?the OnForm show part

Ionut Cristea

  • Posts: 1558
Re: BASS(Android) and Delphi XE5
« Reply #45 on: 6 Jun '14 - 08:17 »
   Check if the BASS_FX was loaded. Something similar to me happend, and seem that it can't load the library.

Re: BASS(Android) and Delphi XE5
« Reply #46 on: 6 Jun '14 - 09:19 »
In fact i think never BASS_FX is loadeded because don't retun OK or OK message..
Here code part:

    //* BASS_FX
    BASSFXLibraryHandle := LoadLibrary(PChar(DocDir + 'libbass_fx.so'));
    if BASSFXLibraryHandle = 0 then begin
         ShowMessage( 'KO');
        Exit;
    end;

    if BASSFXLibraryHandle <> 0 then begin
        ShowMessage( 'OK');
        @BASS_FX_GetVersion := GetProcAddress(BASSFXLibraryHandle, ('BASS_FX_GetVersion'));
        @BASS_FX_TempoCreate := GetProcAddress(BASSFXLibraryHandle, ('BASS_FX_TempoCreate'));
        Result := True;
    end;

Re: BASS(Android) and Delphi XE5
« Reply #47 on: 6 Jun '14 - 11:59 »
I've resolved! simply deleting bassmix funcion in .pas file
It works
Now another problem.
The FXhandle result 0 when in deploy i add libbassmidi.so .... very strange.
The presence of bassmidi sends bassfx ko.

gorghell

  • Posts: 1
Re: BASS(Android) and Delphi XE5
« Reply #48 on: 5 Aug '14 - 17:43 »
Hello,
Could anybody please tell me where could I find the libbass.so file so I can put it in the Library directory?

Thanks.

Ian @ un4seen

  • Administrator
  • Posts: 22841
Re: BASS(Android) and Delphi XE5
« Reply #49 on: 5 Aug '14 - 18:00 »
The Android BASS libraries can found here...

   www.un4seen.com/forum/?topic=13225