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

Headers, Bindings, Libraries for use with FreeBASIC, Please include example of use to help ensure they are tested and usable.
D.J.Peters
Posts: 8586
Joined: May 28, 2005 3:28
Contact:

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

Post by D.J.Peters »

fbsound 1.1 is a auto loaded dynamic lib now !

(no need to copy any files to windows/system or lib folders on Linux)

I added first oop tests also.

Download binary release: fbsound-1.1.zip last upload from: Sep 27, 2020

Download source code: fbsound-1.1-src.zip last upload from: Dec 23, 2018
Last edited by D.J.Peters on Oct 12, 2022 18:17, edited 8 times in total.
badidea
Posts: 2586
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)

Post by badidea »

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: 8586
Joined: May 28, 2005 3:28
Contact:

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

Post by D.J.Peters »

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: 8586
Joined: May 28, 2005 3:28
Contact:

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

Post by D.J.Peters »

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: 8586
Joined: May 28, 2005 3:28
Contact:

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

Post by D.J.Peters »

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: 556
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)

Post by bcohio2001 »

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: 2586
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)

Post by badidea »

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: 2586
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)

Post by badidea »

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: 2586
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)

Post by badidea »

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: 2586
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)

Post by badidea »

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

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

Post by D.J.Peters »

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
Last edited by D.J.Peters on Oct 12, 2022 18:18, edited 1 time in total.
grindstone
Posts: 862
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)

Post by grindstone »

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: 2586
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)

Post by badidea »

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: 8586
Joined: May 28, 2005 3:28
Contact:

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

Post by D.J.Peters »

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: 8586
Joined: May 28, 2005 3:28
Contact:

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

Post by D.J.Peters »

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
Post Reply