Author Topic: BASS for Android  (Read 390469 times)

Jules_

  • Guest
Re: BASS for Android
« Reply #750 on: 17 Nov '14 - 15:02 »
I tested it on Android 5.0 on Nexus 5 and works good!

However, could you provide build for mips architecture in your zip file?
I have several users that can't launch app because the .so is missing for mips.

Thank you!

Ian @ un4seen

  • Administrator
  • Posts: 20400
Re: BASS for Android
« Reply #751 on: 17 Nov '14 - 16:47 »
There was actually an ART compatibility issue when using an array-based ByteBuffer (eg. created with ByteBuffer.allocate rather than ByteBuffer.allocateDirect) with BASS_StreamCreateFile to stream a file from memory, resulting in a crash when freeing the stream. A BASS update to fix that is now up in the 1st post.

As requested, here also is an experimental MIPS build for you to try...

   www.un4seen.com/stuff/bass24-android-mips.zip

It is untested, so please report how you get on with it.

Jules_

  • Guest
Re: BASS for Android
« Reply #752 on: 18 Nov '14 - 09:17 »
Thanks for the MIPS build, unfortunately I don't have any device with this architecture myself but I only notice from play store results that some of my users had this problem.
So I don't know if I will be able to give feedback but thanks anyone for your responsive support!

Ian @ un4seen

  • Administrator
  • Posts: 20400
Re: BASS for Android
« Reply #753 on: 18 Nov '14 - 15:20 »
I forgot to mention that in yesterday's update, BASS_Init will automatically use the AudioTrack.getNativeOutputSampleRate sample rate rather than the one provided in the "freq" parameter unless the BASS_DEVICE_FREQ flag is used. So if you want BASS to output at a specific rate (not necessarily the device's output rate), then the BASS_DEVICE_FREQ flag should be included in the BASS_Init call. A note of that has been added to the 1st post.

JoeK

  • Posts: 22
Re: BASS for Android
« Reply #754 on: 21 Nov '14 - 22:19 »
Hello , mr Ian , i need some help please , im trying to encode a bytebuffer from ENCODERPROC , i have a already made lame wrapper , so no c codes here :
my ENCODERPROC seems like this :
Code: [Select]
short[] Left , Right;
public BASSenc.ENCODERPROC EncodingCallback=new BASSenc.ENCODERPROC() {
        public int ENCODERPROC(int handle, int channel, ByteBuffer buffer, int length, int maxout, Object user) {
    //  encodedBuffer = encodeBuffer(length==-1?null:buffer, length, maxout); // flush upon closing (length=-1)
    //        buffer.clear(); // to make buffer ready for writing
    //       buffer.put(encodedBuffer); // to write the encoded MP3 buffer on the old PCM buffer

        
         buffer.order(null); // little-endian byte order
         ShortBuffer bbuf=buffer.asShortBuffer();; // allocate a buffer for the FFT data
short[] b = new short[length/4];
bbuf.get(b);
for (int x=0 ;x<length/4;x+=2){
Left[x] = b[x];
Right[x] = b[x+1];
}
Lame.encode(leftChannel, rightChannel, channelSamples, mp3Buffer, bufferSize);
Lame.flushEncoder(mp3Buffer, bufferSize);
           return buffer.position();
        }
    };
here is the lame encode function:
Code: [Select]
 public static native int encode(short[] leftChannel,
            short[] rightChannel, int channelSamples, byte[] mp3Buffer,
            int bufferSize);

public static native int flushEncoder(byte[] mp3Buffer, int bufferSize);

im trying first to split the bytebuffer into 2 short channels (left and right) , and then feed them to the encoder , i dont know if that way of splitting is a gd way as shown above , but i think there is lot missing here , i really appreciate if u help me start , thank u :)

cameronkkk

  • Posts: 4
Re: BASS for Android
« Reply #755 on: 24 Nov '14 - 06:26 »
Hi Ian,

I have a parser that parse midi event from a midi file
can I just send those parsed events to BASSMIDI to generate audio
with special soundfont (.sf2)? Is there sample code?

Thanks

Ian @ un4seen

  • Administrator
  • Posts: 20400
Re: BASS for Android
« Reply #756 on: 24 Nov '14 - 13:19 »
Hello , mr Ian , i need some help please , im trying to encode a bytebuffer from ENCODERPROC , i have a already made lame wrapper , so no c codes here :
my ENCODERPROC seems like this :
Code: [Select]
short[] Left , Right;
public BASSenc.ENCODERPROC EncodingCallback=new BASSenc.ENCODERPROC() {
        public int ENCODERPROC(int handle, int channel, ByteBuffer buffer, int length, int maxout, Object user) {
    //   encodedBuffer = encodeBuffer(length==-1?null:buffer, length, maxout); // flush upon closing (length=-1)
    //        buffer.clear(); // to make buffer ready for writing
    //       buffer.put(encodedBuffer); // to write the encoded MP3 buffer on the old PCM buffer

       
        buffer.order(null); // little-endian byte order
        ShortBuffer bbuf=buffer.asShortBuffer();; // allocate a buffer for the FFT data
short[] b = new short[length/4];
bbuf.get(b);
for (int x=0 ;x<length/4;x+=2){
Left[x] = b[x];
Right[x] = b[x+1];
}
Lame.encode(leftChannel, rightChannel, channelSamples, mp3Buffer, bufferSize);
Lame.flushEncoder(mp3Buffer, bufferSize);
           return buffer.position();
        }
    };
here is the lame encode function:
Code: [Select]
  public static native int encode(short[] leftChannel,
            short[] rightChannel, int channelSamples, byte[] mp3Buffer,
            int bufferSize);

public static native int flushEncoder(byte[] mp3Buffer, int bufferSize);

im trying first to split the bytebuffer into 2 short channels (left and right) , and then feed them to the encoder , i dont know if that way of splitting is a gd way as shown above , but i think there is lot missing here , i really appreciate if u help me start , thank u :)

The ENCODERPROC function should probably look something like this...

Code: [Select]
public BASSenc.ENCODERPROC EncodingCallback=new BASSenc.ENCODERPROC() {
public int ENCODERPROC(int handle, int channel, ByteBuffer buffer, int length, int maxout, Object user) {
buffer.order(null); // little-endian byte order
ShortBuffer bbuf=buffer.asShortBuffer();
short[] leftbuf=new short[length/4], rightbuf=new short[length/4];
for (int x=0; x<length/4; x++) {
leftbuf[x]=bbuf.get();
rightbuf[x]=bbuf.get();
}
byte[] mp3buf=new byte[maxout];
int r=Lame.encode(leftbuf, rightbuf, length/4, mp3buf, maxout);
buffer.rewind();
buffer.put(mp3buf, 0, r);
return r;
}
};

I have a parser that parse midi event from a midi file
can I just send those parsed events to BASSMIDI to generate audio
with special soundfont (.sf2)? Is there sample code?

If you have a sequence of events that you would like to play, then you can place the events in an array of BASS_MIDI_EVENT structures and pass that to BASS_MIDI_StreamCreateEvents. Alternatively, if you aren't modifying the events from the MIDI file, then you could simply pass the unparsed MIDI data (or the file itself) to BASS_MIDI_StreamCreateFile. Regarding soundfonts, if you want to use a single SF2 file, then the simplest way to do that is via the BASS_CONFIG_MIDI_DEFFONT option (with BASS_ConfigSetPtr). For more complex soundfont configurations, BASS_MIDI_FontInit and BASS_MIDI_StreamSetFonts can be used. Please see the BASSMIDI documentation for details on the aformentioned functions/options.

JoeK

  • Posts: 22
Re: BASS for Android
« Reply #757 on: 26 Nov '14 - 11:03 »
Mr Ian tnx for ur quick reply , i tried ur code but failed , i checked if the problem was from lame but it wasnt , im sry but im replying from my phone therefore i cant provide my encoder setup but what im doing is ; loading a paused decoded chan then put it into decoded tempo then put it to a mixer chan , then setup the encoder with encodestartuser(mixer,filename,encodelimit,enccallback,0) then encodecastinit(....) then basschanneplay(mixer,false).
The encoder is returing the encode number but the filename size is 0kb , my shoutcast server tells no stream found;bad icy header,that means there is no mp3 data.
I tried to put null on filename , the encode chan is returning 0 and bassgeterror is returning 5.
I tried to remove the encodestartuser and instead i setup a dsp callback and put ur code and calling encodewrite(....) but also failed , im using the newest .so library , i tried some old .so but also failed , i tried to call encodegetversion on creation and returing a number wish means its working.
So im out of ideas therefore if u provide me a complete application for encoding and casting a mixer channel i will be very thankfull . Im sry for bothering , best regards. Thnks.

Ian @ un4seen

  • Administrator
  • Posts: 20400
Re: BASS for Android
« Reply #758 on: 27 Nov '14 - 14:27 »
If you place a breakpoint after the "Lame.encode" call, what return values are you seeing, ie. what is the "r" value?

JoeK

  • Posts: 22
Re: BASS for Android
« Reply #759 on: 28 Nov '14 - 09:22 »
If you place a breakpoint after the "Lame.encode" call, what return values are you seeing, ie. what is the "r" value?

i tried to put 2 breakpoints , 1 on the first line and one for "r" , the first is for length , when i setup everything nothing happens , like the callback function is not called , but when i call BASS_Encode_Stop(Encoder) , i get : -1 for "length" and 0 for "r".
so its obvious that the callback is not called even once , but on stop is called , so what do u suggest to do? do u think that this is happening just in my case? because im confused about the other users on the post u gave me , they say its working and my code is almost the same, thank u.

Ian @ un4seen

  • Administrator
  • Posts: 20400
Re: BASS for Android
« Reply #760 on: 28 Nov '14 - 14:07 »
What are you setting the encoder on, ie. what handle are you using in the BASS_Encode_StartUser call?

JoeK

  • Posts: 22
Re: BASS for Android
« Reply #761 on: 29 Nov '14 - 05:12 »
What are you setting the encoder on, ie. what handle are you using in the BASS_Encode_StartUser call?
here is my structure:
Code: [Select]
Bass.BASS_StreamFree(Chan)
Bass.BASS_StreamFree(Mixer)
Chan = Bass.BASS_StreamCreateFile(Filename,0,0,Bass.BASS_STREAM_DECODE)

Code: [Select]
Chan = Bfx.BASS_FX_TempoCreate(Chan,Bass.BASS_STREAM_DECODE)
Bass.BASS_ChannelGetInfo(Chan,binf)
Mixer = Mx.BASS_Mixer_StreamCreate(binf.freq, binf.chans,Mx.BASS_MIXER_END)
Mx.BASS_Mixer_StreamAddChannel(Mixer,Chan,Mx.BASS_MIXER_NORAMPIN)
Bass.BASS_ChannelSetSync(Mixer,Bass.BASS_SYNC_END,0,EndProc.SyncEnd,0)

Code: [Select]
Encoder = BEnc.BASS_Encode_StartUser(Mixer,File.DirDefaultExternal&"/test.mp3",BEnc.BASS_ENCODE_LIMIT, EncCall.EncodingCallback, 0)

BEnc.BASS_Encode_CastInit(Encoder,ServerIp,ServerPass,BEnc.BASS_ENCODE_TYPE_MP3,ServerName,ServerUrl,ServerGenre,ServerDesc,Null,ServerBitrate,ServerPublic)

Bass.BASS_ChannelPlay(Mixer, False)
BEnc.BASS_Encode_CastSetTitle(Encoder,"hi",ServerUrl)

remember im using Basic4Android compiler so im writing basic language so that s why u see "EncCall.EncodingCallBack".
that's it , do think that BassMix is the problem? i dont think so because i tried it on a normal chan and same problem , thank u have a nice weekend :).
« Last Edit: 29 Nov '14 - 05:17 by JoeK »

Ian @ un4seen

  • Administrator
  • Posts: 20400
Re: BASS for Android
« Reply #762 on: 1 Dec '14 - 14:41 »
That code looks like it should work (you should probably add BASS_FX_FREESOURCE to the BASS_FX_TempoCreate call though). Can you hear the mixer playing on the device? If you set a WAV writer on it (via BASS_Encode_Start with BASS_ENCODE_PCM), do you get a WAV file then?

Ian @ un4seen

  • Administrator
  • Posts: 20400
Re: BASS for Android
« Reply #763 on: 1 Dec '14 - 14:42 »
The latest version (2.4.2) of the BASSFLAC add-on is now up in the 1st post, updating the core decoder to libFLAC 1.3.1.

JoeK

  • Posts: 22
Re: BASS for Android
« Reply #764 on: 2 Dec '14 - 09:24 »
That code looks like it should work (you should probably add BASS_FX_FREESOURCE to the BASS_FX_TempoCreate call though). Can you hear the mixer playing on the device? If you set a WAV writer on it (via BASS_Encode_Start with BASS_ENCODE_PCM), do you get a WAV file then?

Yes Mr Ian , i can hear the mixer playing for sure , and no wav file through also.

Ian @ un4seen

  • Administrator
  • Posts: 20400
Re: BASS for Android
« Reply #765 on: 2 Dec '14 - 15:10 »
Do you get an empty WAV file or no WAV file at all? If the latter, what is the return value from the BASS_Encode_Start call, and if it's 0, what error code does BASS_ErrorGetCode give?

Have you created your own headers to use BASS with Basic4Android, ie. you're not using the BASS.JAVA file? If so, also check that the flags are defined correctly, eg. you haven't accidentally given BASS_ENCODE_LIMIT the BASS_ENCODE_PAUSE value :)

Pranjal

  • Posts: 79
Re: BASS for Android
« Reply #766 on: 3 Dec '14 - 06:43 »

You can then do this in your ENCODERPROC...

Code: [Select]
BASSenc.ENCODERPROC EncodingCallback=new BASSenc.ENCODERPROC() {
        public int ENCODERPROC(int handle, int channel, ByteBuffer buffer, int length, int maxout, Object user) {
            encodedBuffer = encodeBuffer(length==-1?null:buffer, length, maxout); // flush upon closing (length=-1)
            buffer.clear(); // to make buffer ready for writing
            buffer.put(encodedBuffer); // to write the encoded MP3 buffer on the old PCM buffer
            return buffer.position();
        }
    };

Hi Ian,

What is the declaration type for encodedBuffer ?

Pranjal

  • Posts: 79
Re: BASS for Android
« Reply #767 on: 3 Dec '14 - 11:03 »
Quote
Hi Ian,

What is the declaration type for encodedBuffer ?

OK, Got it. Declared as Type ByteBuffer.

But somehow the encoding using LAME is generating error:
Code: [Select]
12-03 12:39:39.073: A/libc(5375): Fatal signal 8 (SIGFPE) at 0x000014ff (code=-6), thread 5573 (com.pk.recaudio)

emile_b

  • Posts: 12
Re: BASS for Android
« Reply #768 on: 3 Dec '14 - 15:26 »
Hi,

I am getting a 'divide by zero' or sometime a sigsegv crash in libbass_fx.so ONLY when using the tempo function is used AND when loading a new file FROM the BASS_SYNC_END function callback.

So what I am trying to do is load the next file in the playlist as soon as the previous finished, this works when I remove 'BASS_FX_TempoCreate' and 'BASS.BASS_STREAM_DECODE'. When they are present it will crash out.

Any ideas?
Thanks
Emile.


emile_b

  • Posts: 12
Re: BASS for Android
« Reply #769 on: 3 Dec '14 - 17:32 »
Hi,

I am getting a 'divide by zero' or sometime a sigsegv crash in libbass_fx.so ONLY when using the tempo function is used AND when loading a new file FROM the BASS_SYNC_END function callback.

So what I am trying to do is load the next file in the playlist as soon as the previous finished, this works when I remove 'BASS_FX_TempoCreate' and 'BASS.BASS_STREAM_DECODE'. When they are present it will crash out.

Any ideas?
Thanks
Emile.


OK Update, it now does not seem to crash because I added a mixer in there. But the tempo function does not work anymore so need to find out what I have done wrong now :)
I need to do gapless so I need the mixer anyway I think.

Ian @ un4seen

  • Administrator
  • Posts: 20400
Re: BASS for Android
« Reply #770 on: 3 Dec '14 - 17:49 »
But somehow the encoding using LAME is generating error:
Code: [Select]
12-03 12:39:39.073: A/libc(5375): Fatal signal 8 (SIGFPE) at 0x000014ff (code=-6), thread 5573 (com.pk.recaudio)

For some clues (hopefully), please also show the call stack from the crash.

OK Update, it now does not seem to crash because I added a mixer in there. But the tempo function does not work anymore so need to find out what I have done wrong now :)
I need to do gapless so I need the mixer anyway I think.

Is the BASS_FX_TempoCreate call failing (returning 0) or just having no effect on the sound? If the latter, are you adjusting the BASS_ATTRIB_TEMPO settings (via BASS_ChannelSetAttribute), and if so, are those calls reporting success in their return values?

emile_b

  • Posts: 12
Re: BASS for Android
« Reply #771 on: 3 Dec '14 - 18:06 »
But somehow the encoding using LAME is generating error:
Code: [Select]
12-03 12:39:39.073: A/libc(5375): Fatal signal 8 (SIGFPE) at 0x000014ff (code=-6), thread 5573 (com.pk.recaudio)

For some clues (hopefully), please also show the call stack from the crash.

OK Update, it now does not seem to crash because I added a mixer in there. But the tempo function does not work anymore so need to find out what I have done wrong now :)
I need to do gapless so I need the mixer anyway I think.

Is the BASS_FX_TempoCreate call failing (returning 0) or just having no effect on the sound? If the latter, are you adjusting the BASS_ATTRIB_TEMPO settings (via BASS_ChannelSetAttribute), and if so, are those calls reporting success in their return values?

OK I finally got tempo and next song in the end sync callback to work, but I had to remove this:

BASS.BASS_MusicFree(mixer);                 
BASS.BASS_StreamFree(mixer);

These were called at the start of the function which loads the file, so they were called in the 'BASS_SYNC_END' callback.

So now my question is when exactly do I need to call these? I'm a bit confused as to when these need to be called to avoid memory leaks, and for example will this cause a memory leak:

Code: [Select]
mixer = BASS_FX.BASS_FX_TempoCreate(mixer,  BASS_FX.BASS_FX_FREESOURCE);
because I lose the first mixer pointer?

Do I need to free the channel handle?

Thanks!

Ian @ un4seen

  • Administrator
  • Posts: 20400
Re: BASS for Android
« Reply #772 on: 3 Dec '14 - 18:23 »
That BASS_FX_TempoCreate call won't cause a leak because the old "mixer" stream will be freed at the same time as the new tempo stream is due to the BASS_FX_FREESOURCE flag. If you would like the stream to be automatically freed at the end of playback, you could also add the BASS_STREAM_AUTOFREE flag to the call.

If you would like to detect whether there are any handle leaks, the BASS_CONFIG_HANDLES option can help with that; it tells how many HSTREAM/HSAMPLE/HMUSIC/HRECORD handles currently exist.

Code: [Select]
int handles=BASS.BASS_GetConfig(BASS.BASS_CONFIG_HANDLES);

emile_b

  • Posts: 12
Re: BASS for Android
« Reply #773 on: 3 Dec '14 - 19:06 »
That BASS_FX_TempoCreate call won't cause a leak because the old "mixer" stream will be freed at the same time as the new tempo stream is due to the BASS_FX_FREESOURCE flag. If you would like the stream to be automatically freed at the end of playback, you could also add the BASS_STREAM_AUTOFREE flag to the call.

If you would like to detect whether there are any handle leaks, the BASS_CONFIG_HANDLES option can help with that; it tells how many HSTREAM/HSAMPLE/HMUSIC/HRECORD handles currently exist.

Code: [Select]
int handles=BASS.BASS_GetConfig(BASS.BASS_CONFIG_HANDLES);

OK great, that CONFIG_HANDLES will be useful.

Back to the crash, I can get it to crash when attempting gapless playback, it also has a tempo changer. It crashes about 1 in 10 times when it get to the end of the file, otherwise it works fine

Here is the player startup:

Code: [Select]
     
        //Load file
        if ((chan=BASS.BASS_StreamCreateFile(file, 0, 0, BASS.BASS_STREAM_DECODE))==0) {// NEEDED FOR TEMPO
            Utils.MyLog(-1,LOG,"Error opening file " + file);
            return false;
        }       

        //Get channel info
        BASS.BASS_CHANNELINFO binf = new BASS_CHANNELINFO();
        BASS.BASS_ChannelGetInfo(chan,binf);

        //Create mixer
        mixer = BASSmix.BASS_Mixer_StreamCreate(binf.freq,2,BASS.BASS_STREAM_DECODE);

        //Add channel
        BASSmix.BASS_Mixer_StreamAddChannel(mixer,chan,BASSmix.BASS_MIXER_NORAMPIN);

        //Save mixer handle for the callback function to use
        mixerOnly = mixer;
       
        //Creates a tempo somehow!
        mixer = BASS_FX.BASS_FX_TempoCreate(mixer,  BASS_FX.BASS_FX_FREESOURCE);
        BASS.BASS_ChannelSetAttribute(mixer, BASS_FX.BASS_ATTRIB_TEMPO,0);
       
        //Setup first sync
        sync = BASS.BASS_ChannelSetSync(chan, BASS.BASS_SYNC_END|BASS.BASS_SYNC_MIXTIME, 0, EndSync,0);

Now the callback:

Code: [Select]
static BASS.SYNCPROC EndSync=new BASS.SYNCPROC() {
        public void SYNCPROC(int handle, int channel, int data, Object user) {
         
            String file = getNextFilename();
           
            //Free???
            BASSmix.BASS_Mixer_ChannelRemove(chan);
            BASS.BASS_StreamFree(chan); 
           
            //Load new file
            if ((chan=BASS.BASS_StreamCreateFile(file, 0, 0, BASS.BASS_STREAM_DECODE))==0) {
                Utils.MyLog(-1,LOG,"Error opening file " + file);
            } 
         
            //Add the new channel, notice its mixerOnly, this is the handle before the BASS_FX_TempoCreate
            BASSmix.BASS_Mixer_StreamAddChannel(mixerOnly,chan,BASSmix.BASS_MIXER_NORAMPIN);
           
            //Reset the mixer positon
            BASS.BASS_ChannelSetPosition(mixer, 0,BASS.BASS_POS_BYTE);
           
            //Reset the sync
            sync = BASS.BASS_ChannelSetSync(chan, BASS.BASS_SYNC_END, 0, EndSync,0);

        }
    };

So this does work, but sometimes crashes. Unfortunately the stack report is not very informative, but here it is:

12-03 19:05:38.294: I/DEBUG(20625):     scr 28000010
12-03 19:05:38.304: I/DEBUG(20625): backtrace:
12-03 19:05:38.304: I/DEBUG(20625):     #00  pc 00024390  /data/app-lib/com.emtronics.longplay-960/libbass.so
12-03 19:05:38.304: I/DEBUG(20625):     #01  pc 000267e3  /data/app-lib/com.emtronics.longplay-960/libbass.so (BASS_ChannelGetData+874)
12-03 19:05:38.304: I/DEBUG(20625):     #02  pc 00004ec5  /data/app-lib/com.emtronics.longplay-960/libbassmix.so
12-03 19:05:38.304: I/DEBUG(20625):     #03  pc 000241dd  /data/app-lib/com.emtronics.longplay-960/libbass.so
12-03 19:05:38.304: I/DEBUG(20625):     #04  pc 000267e3  /data/app-lib/com.emtronics.longplay-960/libbass.so (BASS_ChannelGetData+874)
12-03 19:05:38.304: I/DEBUG(20625):     #05  pc 00006403  /data/app-lib/com.emtronics.longplay-960/libbass_fx.so
12-03 19:05:38.304: I/DEBUG(20625):     #06  pc 000241dd  /data/app-lib/com.emtronics.longplay-960/libbass.so
12-03 19:05:38.304: I/DEBUG(20625):     #07  pc 00024687  /data/app-lib/com.emtronics.longplay-960/libbass.so
12-03 19:05:38.304: I/DEBUG(20625):     #08  pc 00025b03  /data/app-lib/com.emtronics.longplay-960/libbass.so
12-03 19:05:38.304: I/DEBUG(20625):     #09  pc 00025c77  /data/app-lib/com.emtronics.longplay-960/libbass.so
12-03 19:05:38.304: I/DEBUG(20625):     #10  pc 0000ebb7  /data/app-lib/com.emtronics.longplay-960/libbass.so
12-03 19:05:38.304: I/DEBUG(20625):     #11  pc 0000d2a0  /system/lib/libc.so (__thread_entry+72)
12-03 19:05:38.304: I/DEBUG(20625):     #12  pc 0000d438  /system/lib/libc.so (pthread_create+240)

emile_b

  • Posts: 12
Re: BASS for Android
« Reply #774 on: 3 Dec '14 - 22:54 »
OK seems to be stable now, I removed the    BASS.BASS_StreamFree(chan);   from the callback and delayed the fres until the next track finished, obviously it can not freed at the exact end of track. Thanks for the support!