BASS for ARM Linux

Started by Ian @ un4seen,

gigi0ne

hi ian.. it's possible to compile bassmix for hardfp?
thank's luigi

Ian @ un4seen

Yep, a "hardfp" version of BASSMIX.SO is now up in the package in the 1st post.

gigi0ne

hi ian, work perfect.. i think to pass my player on RPi, but using opus.. have you any roadmap for that?
thank's
luigi

Ian @ un4seen

Great to hear that the "hardfp" stuff is working well for you. BASSOPUS has now been added to the package too.

ZXDunny

Hi Ian - just a note to let you know that there may be a bug in

BASS_ChannelSetAttribute(Channel, BASS_ATTRIB_PAN, Panning);

using hardfp version...

A friend of mine is building my BASIC interpreter for raspberry pi in hardfp mode, and gets a floating point exception when that line is executed. The Channel var is HCHANNEL type and is correctly allocated, the Panning var is a float of type double. The compiler is FPC under lazarus. The softfp version works fine (though obviously won't work on a hardfp OS).

Any other info you need, let me know.

Oh, one other thing - very short sounds (such as very quick beeps of pure tone) are sometimes not played on the OpenPandora, or they ramp up in volume briefly at the start. This is using softfp under ARM linux. x86 linux doesn't appear to suffer this issue, but it cannot be ruled out that Pandora's sound hardware might be sub-par and nothing to do with your code. Just a heads-up.

Cheers,

D.

zittergie

Hi Ian,
Is an arm version of BASS FX coming?
I would like to create a reverse stream on arm.

zittergie

Just recompiled my application on the raspberry pi (raspbian) with Lazarus using bass & bassflac and everything worked out fine.

AndroidMediaPlayer

Hi Ian,

got my RPi yesterday. BASS works fine with it. Now we need more Addons. ;)

Ian @ un4seen

Good to hear that things are working well. If there is a particular add-on that you're missing, let me know, and I'll see what can be arranged :)

AndroidMediaPlayer

Ape and Alac if you can would be great, other addons are welcome to, but not so important (for me). A player with more supported Formats is better than a player with less. ;)

Ian @ un4seen

OK. ARM Linux versions of those 2 add-ons are now up in the first post. Let me know if you have any trouble with them.

void256

Hi,

BASS works great on my PI as well! I can load and play an MP3 using the hardfp version without any problems which is just awesome!  :)

However it seems that I'm not able to get FFT-Data using BASS_ChannelGetData(). I only get back an empty float array (all values being 0.0):

while (1) {
                // BASS_ChannelGetLevel works!
                DWORD level, left, right;
                level=BASS_ChannelGetLevel(chan);
                left=LOWORD(level); // the left level
                right=HIWORD(level); // the right level
                printf("%i %i\n", left, right);

                // BASS_ChannelGetData only returns an array of 0.0 (I'd expect different float values)
                float fft[512]; // fft data buffer
                DWORD res = BASS_ChannelGetData(chan, fft, BASS_DATA_FFT1024);
                int i;
                for (i=0; i<512; i++) {
                        printf("%f ", fft[i]);
                }
                printf("\n (%i)\n", res);
        }

Maybe I'm using BASS wrong? Or it might be something else? Someone had success getting FFT-Data on a PI?

Thank you!

Ian @ un4seen

#32
In the ARM Linux version, BASS_ChannelGetData actually delivers FFT data in 8.24 fixed-point form, even in the "hardfp" build. So you would need to modify your code like this...

               int fft[512]; // fft data buffer
                DWORD res = BASS_ChannelGetData(chan, fft, BASS_DATA_FFT1024);
                int i;
                for (i=0; i<512; i++) {
                        float f=(float)fft[i]/(1<<24);
                        printf("%f ", f);
                }

If you're still seeing only 0.0, please confirm what the BASS_ChannelGetData call is returning, ie. the "res" variable value.

xStSx

#33
Hi,
I'm using Raspberry Pi and ArchlinuxARM(3.6.11-2-ARCH+).
I'm trying to build simple examp of libbass but i'm unable to get it playing.

Here is my code:
#include <stdio.h>
#include <stdlib.h>
#include <bass.h>
#include <unistd.h>

void geterror(char *msg)
{
printf("%s:%d\n", msg, BASS_ErrorGetCode());
}

int main(int argc, char *argv[])
{
int pos = 0;
int len = 0;
HSTREAM stream;
char *filepath = argv[1];

printf("\n-----------------------------------------------------------\n");

DWORD ver = BASS_GetVersion();
printf ("\nBASS Version: %d.%d.%d.%d\n\n",(ver>>24)&0xff, (ver>>16)&0xff, (ver>>8) & 0xff, (ver & 0xff));

if(!BASS_Init(-1, 44100, BASS_DEVICE_DMIX, 0, NULL))
{
geterror("Init Error");
}


// ------------------ Get Devices --------------------
int a;
BASS_DEVICEINFO info;
printf("*****Devices Info:*****\n");
for(a=0; BASS_GetDeviceInfo(a, &info);a++)
{
printf("Device %d:%s - %s - %d\n", a, info.name, info.driver, info.flags);
}
printf("\n");
// ---------------------------------------------------




// ----------------- Current Device ------------------
if(BASS_GetDevice() == -1)
geterror("Device Error");
else
printf("Selected Device:%d\n", BASS_GetDevice());
// ---------------------------------------------------




// ---------------- Get Global Volume ----------------
if(BASS_GetVolume() == -1.0)
geterror("Cann't Get Volume Error");
else
printf("%f\n", BASS_GetVolume());
// ---------------------------------------------------


// ---------------- Create Stream --------------------
stream = BASS_StreamCreateFile(FALSE, filepath, 0, 0, 0);
if(stream == 0)
geterror("StreamCreate Error");
else
printf("StreamHandle:%d\n",stream);
// ---------------------------------------------------


len = BASS_ChannelBytes2Seconds(stream,BASS_ChannelGetLength(stream, BASS_POS_BYTE));
pos = 0;

// ---------------- Get Channel Info -------------------
BASS_CHANNELINFO chan_info;
BASS_ChannelGetInfo(stream, &chan_info);
printf("\n*****Channel Info:*****\n");
printf("Freq:%d\n",chan_info.freq);
printf("Channels:%d\n",chan_info.chans);
printf("Bps%d\n",chan_info.origres);
printf("Filename:%s\n\n",chan_info.filename);
printf("\n");
// -----------------------------------------------------

        if(BASS_ChannelPlay(TRUE, stream))
{
geterror("Play");
}
while(1)
{
if(BASS_ChannelIsActive(stream) != 0)
{
pos = BASS_ChannelBytes2Seconds(stream, BASS_ChannelGetPosition(stream, BASS_POS_BYTE));

if(len == pos)
break;

printf("%02d:%02d - %02d:%02d\n",(int)(len/60), (int)(len%60), (int)(pos/60), (int)(pos%60));
}
usleep(100000);
}
BASS_ChannelStop(stream);
BASS_StreamFree(stream);

BASS_Free();


return 0;
}

Output of this code:
-----------------------------------------------------------

BASS Version: 2.4.9.3

*****Devices Info:*****
Device 0:No sound - (null) - 1
Device 1:Default - default - 7
Device 2:bcm2835 ALSA: bcm2835 ALSA - hw:0,0 - 1

Selected Device:1
Cann't Get Volume Error:37
StreamHandle:-1342177279

*****Channel Info:*****
Freq:44100
Channels:2
Bps0
Filename:./Red Hot Chillipeper - Snow.mp3

GetVolume() return -1.0 with ErrorCode 37 (37 = BASS_ERROR_NOTAVAIL There is no volume control when using the "no sound" device.) but I'm using device 1.  ???

as well no sound, and stream doesn't playing.
Am I missing something ?
Thank you.
Stas.

Ian @ un4seen

Quote from: xStSx        if(BASS_ChannelPlay(TRUE, stream))
{
geterror("Play");
}

Those BASS_ChannelPlay parameters should be the other way round, ie. the stream handle should be the 1st parameter. Also, a "TRUE" return value would indicate success rather than failure, so that needs to be changed too, ie. add a "!" in there. Let me know if it's still not working after doing that.

Quote from: xStSxGetVolume() return -1.0 with ErrorCode 37 (37 = BASS_ERROR_NOTAVAIL There is no volume control when using the "no sound" device.) but I'm using device 1.  ???

It is also possible that BASS can't find a volume control on a soundcard/driver (I'll get the docs updated to mention that!), which seems to be the case there. In that case, the global volume options (eg. BASS_CONFIG_GVOL_STREAM) are still available to control the level of the BASS output.

xStSx

Quote from: Ian @ un4seen
Quote from: xStSx        if(BASS_ChannelPlay(TRUE, stream))
{
geterror("Play");
}

Those BASS_ChannelPlay parameters should be the other way round, ie. the stream handle should be the 1st parameter. Also, a "TRUE" return value would indicate success rather than failure, so that needs to be changed too, ie. add a "!" in there. Let me know if it's still not working after doing that.

oops.. so stupid mistake  :)

        if(!BASS_ChannelPlay(stream, TRUE))
{
geterror("Play");
}

It's working , thanks  ;D

void256

Quote from: Ian @ un4seenIn the ARM Linux version, BASS_ChannelGetData actually delivers FFT data in 8.24 fixed-point form, even in the "hardfp" build.

Thanks a lot! It works now!

And Ian? You Rock!  :D

drugoimir

Hi Ian,

is also bassenc planned to be recompiled for arm?

Bye
Tom

Ian @ un4seen

Yep. An ARM Linux version of the BASSenc add-on is now up in the first post.

drugoimir

Great Ian!!!!
I'll try and let you know!

Thanks!