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

sayadallel

  • Posts: 4
Re: BASS(Android) and Delphi XE5
« Reply #50 on: 22 Nov '14 - 23:42 »
Hi everybody

on Android 4.4.2 KitKat and Delphi XE7 :
the application Crashes when i try to Init Bass library :
Code: [Select]
BASS_Init(-1,44100, BASS_DEVICE_DEFAULT,Handle,nil);
now if i use device 0 instead of -1 then its stop crashing :
 But i can't play any stream !! and i get error 5 and error 37 when using BASS_StreamCreateURL .

rem: NetRadio.apk is not working in KitKat too

seems like the libbass.so is not compatible with the Android 4.4.2 or some thing ??

Any Ideas ?


Regards
and thanks for your Great Job on this Library
« Last Edit: 23 Nov '14 - 14:59 by sayadallel »

sayadallel

  • Posts: 4
Re: BASS(Android) and Delphi XE5
« Reply #51 on: 28 Nov '14 - 03:38 »
well
i tried  to use Device "0" (no device) , and decoded chanel.
spending a long time to change the code from: C Style to Delphi Style , .

it is working now ,

 But i have this problem:
it is playing the stream Very Fast (2X or 4X time)

snip :
Code: [Select]
BASS_StreamFree(uStream); // close old stream
 BASS_SetDevice(0);
 uStream:=BASS_StreamCreateURL(Pchar(URL),0,BASS_STREAM_DECODE or BASS_UNICODE ,nil,nil);

 track := TJAudioTrack.JavaClass.init(3,44100,3,2, TJAudioTrack.JavaClass.getMinBufferSize(44100,3,2),1);
 track.play;

 jbuffer:=  TJavaArray<SmallInt>.Create(20000);

 res:=BASS_ChannelGetData(uStream, @buffer[1],Length( buffer));
 while (res <> -1)  do
   begin
      if res > 0 then
      begin
...

some code here

...
        track.write( jbuffer,0,res ) ;
      end
      else    try
          Sleep(250);
       except        end;

      res:=BASS_ChannelGetData( uStream, @buffer[1], Length( buffer)); // decode some data
    end;

Ionut Cristea

  • Posts: 1558
Re: BASS(Android) and Delphi XE5
« Reply #52 on: 28 Nov '14 - 05:28 »
Quote
TJAudioTrack.JavaClass.init(3,44100,3,2, TJAudioTrack.JavaClass.getMinBufferSize(44100,3,2),1);

Use here the values for freq, channels retrieved from BASS_ChannelGetInfo function :)

sayadallel

  • Posts: 4
Re: BASS(Android) and Delphi XE5
« Reply #53 on: 28 Nov '14 - 21:42 »
thanks Ionut .

Done ..

the problem was using STEREO instead of MONO :
the new Code will be :

Code: [Select]
track := TJAudioTrack.JavaClass.init(TJAudioManager.JavaClass.STREAM_MUSIC,
                                       info.freq,
                                       TJAudioFormat.JavaClass.CHANNEL_CONFIGURATION_MONO ,
                                       TJAudioFormat.JavaClass.ENCODING_PCM_16BIT,
                                      TJAudioTrack.JavaClass.getMinBufferSize(info.freq,
                                                               TJAudioFormat.JavaClass.CHANNEL_CONFIGURATION_MONO,
                                                               TJAudioFormat.JavaClass.ENCODING_PCM_16BIT),
                                                               TJAudioTrack.JavaClass.MODE_STREAM);


i still have glitchesin the  Stream ,it makes regular cuts like this :
3 sec sound then 3 sec off  again and again !!



any idea ?

Regards
« Last Edit: 29 Nov '14 - 01:58 by sayadallel »

Ionut Cristea

  • Posts: 1558
Re: BASS(Android) and Delphi XE5
« Reply #54 on: 29 Nov '14 - 07:44 »
 Create a thread that will use BASS_ChannelGetData and track.write function. Also you may want to try without that Sleep to see what it happen.

sayadallel

  • Posts: 4
Re: BASS(Android) and Delphi XE5
« Reply #55 on: 1 Dec '14 - 03:24 »
i already did that ...

it still cut's !!

it play sounds for 3 sec then stop playing for 3 sec while GetData(..);

i guess there must be a variable to set some buffer or some thing!!

Polywick Studio

  • Posts: 17
Re: BASS(Android) and Delphi XE5
« Reply #56 on: 16 Jan '16 - 01:55 »

I got similar error for speed too fast.

When you load, make sure you * 2 (sizeof) as you are loading Unicode, and have BASS_UNICODE for Delphi/Android, Delphi/iOS for filenames.


Hello,
Could anybody please tell me where could I find the libbass.so file so I can put it in the Library directory?

Thanks.

It's in the Bass-Android.ZIP file. under /Lib/*

Polywick Studio

  • Posts: 17
Re: BASS(Android) and Delphi XE5
« Reply #57 on: 16 Jan '16 - 01:58 »
Hi everybody

on Android 4.4.2 KitKat and Delphi XE7 :
the application Crashes when i try to Init Bass library :
Code: [Select]
BASS_Init(-1,44100, BASS_DEVICE_DEFAULT,Handle,nil);
now if i use device 0 instead of -1 then its stop crashing :
 But i can't play any stream !! and i get error 5 and error 37 when using BASS_StreamCreateURL .

rem: NetRadio.apk is not working in KitKat too

seems like the libbass.so is not compatible with the Android 4.4.2 or some thing ??

Check if you have populated the 3 different bass libraries to:

/libs/x86/*
/libs/armeabi/*
/libs/armabii-v7a/*

No crashes with Android 4.4.2, Android 4.5 here.

Polywick Studio

  • Posts: 17
Re: BASS(Android) and Delphi XE5
« Reply #58 on: 16 Jan '16 - 02:02 »
help me how to make Cyrillic a meta ???

In order to use Cyrillic, you need to encode the URLs you use. Use UTF8Encode to encode the Russian/Hungarian/French URLs to normal escaped URLs.


pkklovezp

  • Posts: 1
Re: BASS(Android) and Delphi XE5
« Reply #59 on: 19 Jun '16 - 13:12 »
 ;D ;D谢谢,感谢大家,我是一名来自中国的业余delphi爱好者...

drama22

  • Posts: 17
Re: BASS(Android) and Delphi XE5
« Reply #60 on: 22 Feb '17 - 07:18 »
is this unit is up to date ?

i can see a plugins that not exist in current bass version

    BASS_PluginLoad(PChar(DocDir + 'libbass_aac.so'), BASS_UNICODE);
    BASS_PluginLoad(PChar(DocDir + 'libbass_alac.so'), BASS_UNICODE);
    BASS_PluginLoad(PChar(DocDir + 'libbass_ape.so'), BASS_UNICODE);
    BASS_PluginLoad(PChar(DocDir + 'libbass_mpc.so'), BASS_UNICODE);

drama22

  • Posts: 17
Re: BASS(Android) and Delphi XE5
« Reply #61 on: 23 Feb '17 - 08:40 »
trying to play from memory stream but no sound

Stream.Position := 0;
while Stream.Position < Stream.Size do
begin

AudioDataSize := BASS_StreamCreateFile(True,Stream.Memory,0,Stream.Size, 0);
try

BASS_ChannelPlay(AudioDataSize, False);
except
//log any exception
end;
« Last Edit: 23 Feb '17 - 16:29 by drama22 »