fbsound 1.1 (dynamic) Windows/Linux 32 and 64-bit (wav mp3 ogg mod it xm s3m)

External libraries (GTK, GSL, SDL, Allegro, OpenGL, etc) questions.
D.J.Peters
Posts: 7702
Joined: May 28, 2005 3:28

fbsound 1.1 (dynamic) Windows/Linux 32 and 64-bit (wav mp3 ogg mod it xm s3m)

Postby D.J.Peters » Dec 22, 2018 20:00

Download binary release: fbsound-1.1.zip last upload from: Dec 23, 2018
(fbsound-32.dll, fbsound-64.dll, libfbsound-32.so, libfbsound-64.so ...)

Download source code: fbsound-1.1-src.zip last upload from: Dec 24, 2018
(NOTE: Include files like fbsound.bi from source package are not the same as in the binary release so don't mix it)

What's new ? Only small fixes, fbsGetKeyCode are removed I added a fbsound runtime loader and it comes from the future :-)
fbsound-1.1 wrote:Copyright 2005 - 2019 by D.J.Peters (Joshy)
Linking complex static lib's like fbsound witch self used a bunch of other static lib's (libCPU, libDSP, libDumb, libMad, libOGG, libVorbis, libVorbisFile)
you will run in to problems of incompatibilities GCC 4.x vs. GCC 8.2
(The current stable version of GCC is 8.2, which was released on July 26, 2018.)
Note: same if you build static libs with GCC 8.2 and the user of your lib used GCC 4.x

The only solution for different GCC environments are using dynamic libraries.

I hope it works on all your boxes If not give me a feedback please

By the way you don't need the compiler option -mt any more.

Thank you.

Joshy

Tip: If you build with FreeBASIC dynamic lib's for Linux 64-bit and you used pre builded static libs.
fbc -dyn stuff.bas -l StuffX -l StuffY -l StuffZ -o libfunkystuff.so

you have to rebuild libStuffX.a, libStuffY.a libStuffZ.a with -pic before !
fbc -lib -pic StuffX.bas
fbc -lib -pic StuffY.bas
fbc -lib -pic StuffZ.bas
fbc -dyn stuff.bas -l StuffX -l StuffY -l StuffZ -o libfunkystuff.so
Last edited by D.J.Peters on Dec 24, 2018 11:03, edited 4 times in total.
badidea
Posts: 1401
Joined: May 24, 2007 22:10
Location: The Netherlands

Re: fbsound 1.1 (dynamic) Windows/Linux 32 and 64-bit (wav mp3 ogg mod it xm s3m)

Postby badidea » Dec 22, 2018 22:11

D.J.Peters wrote:I hope it works on all your boxes If not give me a feedback please

Not yet, but I will try to figure it out.

Too complicated for today, I get:
./fbs_create_wave: error while loading shared libraries: libfbsound-32.so: cannot open shared object file: No such file or directory
But the file is there (same folder as .bas file), if I rename it, I get (as expected):
ld: cannot find -lfbsound-32
So my computer is lying or some kind of version conflict.

The previous version (fbsound-1.0) still works. It is in another location, but maybe I copied stuff from this version to the FBC location, which is now the conflict...

If I add working directory to $LD_LIBRARY_PATH and export it, I get sound work with 64-bit FBC (not with FBC 32-bit)
https://stackoverflow.com/questions/480 ... s#21173918
It seems that I have to put libfbsound-XX.so somewhere else (or change this library path every time).
D.J.Peters
Posts: 7702
Joined: May 28, 2005 3:28

Re: fbsound 1.1 (dynamic) Windows/Linux 32 and 64-bit (wav mp3 ogg mod it xm s3m)

Postby D.J.Peters » Dec 23, 2018 3:31

On Windows the *.dll library can be in the system path or in the same folder as the *.exe
On Linux the *.so library must be in the search path of ld (command ldconfig)

If you know the folder you have to copy libfbsound-32.so to it.

Joshy
D.J.Peters
Posts: 7702
Joined: May 28, 2005 3:28

Re: fbsound 1.1 (dynamic) Windows/Linux 32 and 64-bit (wav mp3 ogg mod it xm s3m)

Postby D.J.Peters » Dec 23, 2018 6:11

I added a fbsound runtime loader (it's optional)
No need to create a setup program if you will publish your compiled game, demo or what ever .
No need to copy libraries to any system path e.g. on Linux ...

It's usage is totally simple instead of #include "fbsound.bi" use #include "fbsound_dynamic.bi"

that's all :-)

If you extracted fbsound-1.1.zip delete it first before you extract the latest version.
(don't overwrite the old version with the new)

Joshy
D.J.Peters
Posts: 7702
Joined: May 28, 2005 3:28

Re: fbsound 1.1 (dynamic) Windows/Linux 32 and 64-bit (wav mp3 ogg mod it xm s3m)

Postby D.J.Peters » Dec 23, 2018 21:22

Over 100 views from you but no feedback does it works on your boxes or not it's a shame.
I spent my rare free time for all the community projects and get no support.
Looks like the Delphi and PureBasic and other communities are more thank full for free working stuff.

How ever currently I add a simple to use OOP interface.
(I will use it for the FreeBASIC love letter game dev competition)

Joshy

here are how it looks

Code: Select all

#include once "../inc/fbsound_oop.bi"
var Device  = SoundDevice()
var Samples = SampleBuffer("../data/jimi.mod")
var Sound   = SoundBuffer(Samples)
Sound.Volume = 0.8
Sound.Play
print "play time: " & Samples.Length & " seconds"
print "press any key ..." : sleep
bcohio2001
Posts: 526
Joined: Mar 10, 2007 15:44
Location: Ohio, USA
Contact:

Re: fbsound 1.1 (dynamic) Windows/Linux 32 and 64-bit (wav mp3 ogg mod it xm s3m)

Postby bcohio2001 » Dec 23, 2018 21:57

I think that I speak for most of the users here. You are doing a great job in EVERYTHING that you submit. And we are thankful.

To be honest, I do not have a single music file on my system. So I have no use for this.

I have tried to adapt you SNC to make a PNC. (Programmable Network Connection)
Just having trouble finding alternatives for window's InternetCrackUrl() .....
badidea
Posts: 1401
Joined: May 24, 2007 22:10
Location: The Netherlands

Re: fbsound 1.1 (dynamic) Windows/Linux 32 and 64-bit (wav mp3 ogg mod it xm s3m)

Postby badidea » Dec 23, 2018 22:08

It is weird indeed, stuff like "I found this method for 10% faster string processing" or "I found more efficient way to store a rectangle in memory" get lots of reactions. When the subject is "an actual sound library which freebasic badly needs", no replies. Getting distracted by non-essential details seems an illness effecting most (hobby) programmers (often including myself).

I did not have time for FreeBASIC today, but I will look into your library some more, since I also plan to use it for my game (if that is ok).

Note on changelog.txt: "dynmaic" -> "dynamic"
badidea
Posts: 1401
Joined: May 24, 2007 22:10
Location: The Netherlands

Re: fbsound 1.1 (dynamic) Windows/Linux 32 and 64-bit (wav mp3 ogg mod it xm s3m)

Postby badidea » Dec 23, 2018 23:30

Testing the new version with "fbsound_dynamic.bi". No libraries build yet.

Test file: fbs_create_wave.bas

Linux FBC 32 bit:
Works fine. Only at exit some werid text is displayed at the terminal, like: x� ��S�ion.name.
If I remember correct, fbsound-0.1 (from 2010) did that as well.

Linux FBC 64 bit:
error: lib fbsound-64 not loaded !
Aborting due to runtime error 7 (null pointer access) at line 18 of fbs_create_wave.bas::()
So some check if needed before calling fbs_Init() in this case
Last edited by badidea on Dec 23, 2018 23:39, edited 1 time in total.
badidea
Posts: 1401
Joined: May 24, 2007 22:10
Location: The Netherlands

Re: fbsound 1.1 (dynamic) Windows/Linux 32 and 64-bit (wav mp3 ogg mod it xm s3m)

Postby badidea » Dec 23, 2018 23:38

Test2, with building the libaries.

./buildlib-32.sh
build cpu layer
build dsp
build fbsound
build plug alsa
ld: cannot find -lasound
build plug dsp
build plug arts
ready!

./buildlib-64.sh
build cpu layer
build dsp
build fbsound
build plug alsa
ready!

I changed the scripts so that either fbc32 or fbc64 is called.
For some reason, I cannot install the libasound 32-bit version on my laptop.

Linux FBC 32 bit:
error: FBS_INIT()

Linux FBC 64 bit:
Works perfect. Also not weird text on exit displayd.
badidea
Posts: 1401
Joined: May 24, 2007 22:10
Location: The Netherlands

Re: fbsound 1.1 (dynamic) Windows/Linux 32 and 64-bit (wav mp3 ogg mod it xm s3m)

Postby badidea » Dec 23, 2018 23:45

Update. Had to install "libasound2-dev:i386"
Now 64 & 32 bit OK. I will test some other example codes later.
D.J.Peters
Posts: 7702
Joined: May 28, 2005 3:28

Re: fbsound 1.1 (dynamic) Windows/Linux 32 and 64-bit (wav mp3 ogg mod it xm s3m)

Postby D.J.Peters » Dec 24, 2018 10:46

Hello badidea first thank you for your support.
fbsound must run from binary package without to recompile it from source or move any *.so lib around !
Any NULL pointer access you talked about can be fixed easily but later.

To see whats going on can you do the same steps I do PLEASE ?

First download latest upload of fbsound-1.1.zip from "Dec 24, 2018" in you HOME folder.
I added:
inc/fbsound_oop.bi
and firsts oop tests
tests/oop_test01.bas
tests/oop_test02.bas
tests/oop_test03.bas
tests/oop_test04.bas

OK open a terminal and navigate to the HOME folder where you downloaded fbsound-1.1.zip
cd $HOME

(show the fbsound stuff)
ls fbs*.*

(remove any extracted old fbsound-1.1 folder if exists and it's sub folders)
rm -r fbsound-1.1

(unzip the fresh downloaded zip file)
unzip fbsound-1.1.zip

Then navigate to the tests folder and compile as a simple test fbs_load_mod.bas and run it
Image
You should hear the mod file playing and see the same text output.

From my screen shot you can see it works here without any problems.

If you don't hear any sound be sure your audio mixer settings are OK.

If you get any error message or crap output please post it

or make a screen shot of the terminal window and post it.

By the way I tested fbsound-1.1 successful on:
Windows XP 32-bit
Windows 7 32-bit
Windows 10 64-bit
Linux Slackware 14.2 32-bit
Linux Ubuntu 18.4 64-bit

Thank you.

Joshy
grindstone
Posts: 640
Joined: May 05, 2015 5:35
Location: Germany

Re: fbsound 1.1 (dynamic) Windows/Linux 32 and 64-bit (wav mp3 ogg mod it xm s3m)

Postby grindstone » Dec 24, 2018 11:38

D.J.Peters wrote:Over 100 views from you but no feedback does it works on your boxes or not it's a shame.
I'll give you feedback as soon as I found the time to test it. Promise!
badidea
Posts: 1401
Joined: May 24, 2007 22:10
Location: The Netherlands

Re: fbsound 1.1 (dynamic) Windows/Linux 32 and 64-bit (wav mp3 ogg mod it xm s3m)

Postby badidea » Dec 24, 2018 11:43

That is in essence the same as what I did.
New download, fbsound-1.1.zip only, new location:

badidea@laptop:~/fbsound-1.1/tests$ fbc32 fbs_load_mod.bas
badidea@laptop:~/fbsound-1.1/tests$ ./fbs_load_mod
load: jimi.mod
ok
length of 'jimi.mod' = 125.339 seconds
wait on end of sound or press any key ...
en_US.UTF-8badidea@laptop:~/fbsound-1.1/tests$ fbc64 fbs_load_mod.bas
badidea@laptop:~/fbsound-1.1/tests$ ./fbs_load_mod
error: lib fbsound-64 not loaded !
Segmentation fault (core dumped)


32-bit works (sound), but displays "en_US.UTF-8" now
64-bit goes wrong

gcc (Ubuntu 5.4.0-6ubuntu1~16.04.10) 5.4.0 20160609
FreeBASIC Compiler - Version 1.05.0 (01-31-2016), built for linux-x86 (32bit)
FreeBASIC Compiler - Version 1.05.0 (01-31-2016), built for linux-x86_64 (64bit)
Ubuntu Mate 16.04.5 LTS 64-bit

Same behaviour on my other laptop (also Standard Ubuntu 16.04.4 LTS 64-bit, FBC 64 bit only). After "buildlib-64.sh" ok.
Last edited by badidea on Dec 24, 2018 12:32, edited 1 time in total.
D.J.Peters
Posts: 7702
Joined: May 28, 2005 3:28

Re: fbsound 1.1 (dynamic) Windows/Linux 32 and 64-bit (wav mp3 ogg mod it xm s3m)

Postby D.J.Peters » Dec 24, 2018 12:31

I see you use a old version of FreeBASIC but this must not be the problem.

First let us test if your ld config is the problem
only for this test copy libfbsound-64.so in your library system folder
to see where the loader looks for libraries execute the ldconfig command

ldconfig

or if you need root rights
sudo ldconfig

if it shows you folders like /usr/lib or /usr/local/lib or /usr/lib64 etc.
copy fbsound-64.so to one of them
cd fbsound-1.1/tests
cp libfbsound-64.so /usr/lib

test 1: execute the old compiled test again
./fbs_load_mod

if this fails also we make test 2:
edit fbs_load_mod.bas
comment out #include "../inc/fbsound_dynamic.bi" and use instead the line
#include "../inc/fbsound.bi"
save your changes recompile and execute it.
fbc fbs_load_mod.bas
./fbs_load_mod

Does step 1 works or fails ?
Does step 2 works or fails ?

Joshy
D.J.Peters
Posts: 7702
Joined: May 28, 2005 3:28

Re: fbsound 1.1 (dynamic) Windows/Linux 32 and 64-bit (wav mp3 ogg mod it xm s3m)

Postby D.J.Peters » Dec 24, 2018 12:48

Or wait may be your OS can only access libraries with the right permission flags are set.
binaries compressed files with zip will lose there permission flags

Again don't use your recompiled version of fbsound this way we never can't locate the real problem.

Imagine you will publish a binary package of your game with sound created with FreeBASIC
the user extract your published archive and will execute it
Without to install FreeBASIC and all the dev packages and recompile your game.

Note: delete the temporary copy of /usr/lib/libfbsound-64.so or where ever you made the copy

cd $HOME
rm -r fbsound-1.1
unzip fbsound-1.1.zip
cd fbsound-1.1/tests
chmod -x libfbsound64.so
fbc fbs_load_mod.bas
./fbs_load_mod

if this solves the problem I will upload one Windows fbsound-1.1.zip archive
and one Linux archive (with the right flags) fbsound-1.1.tar.gz

Joshy

Return to “Libraries”

Who is online

Users browsing this forum: Red2 and 1 guest