fbsound 1.2 Windows/Linux (sid 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.2 Windows/Linux (sid wav mp3 ogg mod it xm s3m)

Post by D.J.Peters »

fbsound 1.2 is a auto loaded dynamic lib now
(no need to copy any files to windows/system32 or lib folders on Linux)

This is for Windows the final version now !

The Linux version is compiled with console debug infos !

Download binary release: fbsound-1.2.zip last upload from: Oct 21, 2020

Download source code: fbsound-1.2-src.zip last upload from: Oct 21, 2020

The zip file is for Window and Linux 32 and 64-bit !

On Windows 32-bit you need only:
fbsound-32.dll and fbsound-mm-32.dll

On Windows 64-bit you need only:
fbsound-64.dll and fbsound-mm-64.dll

On Linux 32-bit you need only:
libfbsound-32.so and libfbsound-alsa-32.so

On Linux 64-bit you need only:
libfbsound-64.so and libfbsound-alsa-64.so

Ofcourse the include file "fbsound_dynamic.bi" on all systems :-)

Test all examples from /tests folder and report any problems please !

On Linux dylibfree() makes sometimes trouble i'm working on it (that is an old known FreeBASIC problem)

Joshy

EDIT: How to compile fbsound 1.2 !
You have to extract both zip files: fbsound-1.2.zip and fbsound-1.2-src.zip

result on Windows:
ANY_DRIVE:\SAME_PATH\fbsound-1.2\
ANY_DRIVE:\SAME_PATH\fbsound-1.2-src\

result on Linux:
$HOME/fbsound-1.2/
$HOME/fbsound-1.2-src/

First before you execute any buildlib script from fbsound-1.2-src folder
edit the script (*.bat or *.sh) and set the right path's !

for example on my win64 box I have fbc for 32-bit and 64-bit in the same folder but with different names !
d:\FreeBASIC\fbc32.exe
d:\FreeBASIC\fbc64.exe

On Linux before you can execute any buildlib*.sh script you must make it executable.

cd fbsound-1.2-src
chmod +x ./bildlib-32.sh

or
chmod +x ./bildlib-64.sh

On both Windows and Linux the results of the build process from "fbsound-1.2-src" folder are stored in: "fbsound-1.2/tests"

Why building fbsound-1.2 self ? "The question of the day :-)"

Imagine you create a demo or a complete game and you like to publish it for Windows and Linux both 32/64-bit.

For example if your game used only *.wav files you can edit the file: "fbsound-1.2-src/inc/fbstypes.bi" and disable all other file formats.

Code: Select all

' disable some features and rebuild the lib
#define NO_MP3
#define NO_OGG
#define NO_MOD
#define NO_SID
with this changes execute the "buildlib-xx" scrips
copy the uncommented defines or edit the same defines in "/fbsound-1.2/inc/fbsound-dynamic.bi"

Code: Select all

' # fbsound_dynamic.bi #
#define NO_MP3       ' no MP3 sound and stream 
#define NO_OOG       ' no Vorbis sound
#define NO_MOD       ' no tracker modules
#define NO_SID       ' no SID stream
Ofcourse for your final project you should comment "'#define DEBUG" in:
"/fbsound-1.2-src/inc/fbstypes.bi"
and
"/fbsound-1.2/inc/fbsound-dynamic.bi"

Same for other options: NO_DSP NO_PLUG_DS NO_PLUG_MM NO_PLUG_ARTS NO_PLUG_DSP
Remember any changes you made in file: fbsound-1.2-src/inc/fbs_types.bi must done in file: fbsound-1.2/inc/fbsound_dynamic.bi also !°

IMPORTANT IMPORTANT IMPORTANT
The Linux version used #define DEBUG and the fbc -g compiler switch.
You can remove "-g" switch in the buildlib scripts also !

EDIT: A note about fbsound-1.2 output drivers:
On Windows 32/64-bit the DirectX sound drivers are optional fbsound-ds-32.dll and fbsound-ds-64.dll and can be deleted !
(you can #define NO_PLUG_DS and recompile the lib if you like but deleting only is OK also)

On Linux 32-bit the "/dev/dsp" and ARTS server driver libfbsound-dsp-32.dll and libfbsound-arts-32.dll are optional and can be deleted !
(you can #define NO_PLUG_DSP #define NO_PLUG_ARTS and recompile the lib if you like but deleting only is OK also)

Again OPTIONAL means OPTIONAL you can delete it without to recompile the library !

If I self write a game (and I do it since last 3 month a real secret) I would prever to add a sound device selection menu.
So it's the user's choice to select a play back device and and its parameters.

something like:
(*) Windows default device
( ) DirectX device
( ) 98 KHz (*) 44 KHz ( ) 22 KHz
(*) stereo ( ) mono
...
Last edited by D.J.Peters on Oct 12, 2022 18:14, edited 9 times in total.
VANYA
Posts: 1834
Joined: Oct 24, 2010 15:16
Location: Ярославль
Contact:

Re: preview: of fbsound 1.2 (dynamic) Windows/Linuxt (sid wav mp3 ogg mod it xm s3m)

Post by VANYA »

Linux 64-bit: work fine.

Joshy one small note: when compiling a library, it is better to check if the folder exists /fbsound-1.2/tests/ and if it does not exist, then compile into the folder lib/. Thanks!
Roland Chastain
Posts: 993
Joined: Nov 24, 2011 19:49
Location: France
Contact:

Re: preview: of fbsound 1.2 (dynamic) Windows/Linuxt (sid wav mp3 ogg mod it xm s3m)

Post by Roland Chastain »

Tested successfully Linux 32 and 64 (both on a 64 machine).

Not really important, but fbs_Set_PlugPath() still doesn't work for me. I don't really need it. If it can't be fixed, maybe you could simply remove it? Just a suggestion. I hope you won't take it bad.

debug: fbsound-1.2 RuntimeUnload Destructor

Aborting due to runtime error 7 (null pointer access) at line 4 of /home/roland/Documents/basic/echecs/eschecs-202010150731-fbs12/source/sound.bas::INITSOUND()
UEZ
Posts: 972
Joined: May 05, 2017 19:59
Location: Germany

Re: preview: of fbsound 1.2 (dynamic) Windows/Linuxt (sid wav mp3 ogg mod it xm s3m)

Post by UEZ »

Cool, I just tested it playing a SID file and works properly.

Thanks for sharing. :-)
D.J.Peters
Posts: 8586
Joined: May 28, 2005 3:28
Contact:

Re: preview: of fbsound 1.2 (dynamic) Windows/Linuxt (sid wav mp3 ogg mod it xm s3m)

Post by D.J.Peters »

VANYA wrote:Linux 64-bit: work fine.
Thank you for testing :-)
VANYA wrote:Joshy one small note: when compiling a library, it is better to check if the folder exists /fbsound-1.2/tests/ and if it does not exist, then compile into the folder lib/.
Good point thanks. (I added "How to compile fbsound-1.2 see first post)
Roland Chastain wrote:Tested successfully Linux 32 and 64 (both on a 64 machine).
Thank you for testing :-)
How do you setup fbc 32 and 64 bit on the 64-bit PC ?
UEZ wrote:Thanks for sharing. :-)
Thanks for testing :-)

Joshy
Last edited by D.J.Peters on Oct 21, 2020 10:48, edited 1 time in total.
D.J.Peters
Posts: 8586
Joined: May 28, 2005 3:28
Contact:

Re: preview: of fbsound 1.2 (dynamic) Windows/Linuxt (sid wav mp3 ogg mod it xm s3m)

Post by D.J.Peters »

Roland Chastain wrote:fbs_Set_PlugPath() still doesn't work for me.
You are right it was _Adjust_Path(exepath()) for a debug session and i forgot to change it back.
In file: fbsound-1.2-src/src/fbsound.bas you can replace exepath() with _PlugPath:

Code: Select all

private function _Get_PlugPath() as string
  dim as string tmp = _Adjust_Path(_PlugPath) ' <-- this will work !
  return tmp
end function
I moved all fbsound-mm*.dll fbsound-ds*.dll fbsound-also*.so files in a new folder one level up ../bin and it works :-)

Joshy
fbsound-1.2 wrote:debug: fbsound-1.2()
debug: DyLibLoad( 'fbsound-64' )
debug: cpu:()
debug: GenuineIntel, X86_64, 2 cpu cores, CPUID, FPU, RDTSC, CMOVxx, FCMOVxx, MMX I,II, SSE,2,3,4.1 ~2666 MHz
debug: _fbs_init() module constructor
debug: _fbs_init() module constructor call dumb_register_stdfiles()
debug: FBS_Set_PlugPath(../bin/)
debug: fbs_Init(44100, 2, 3, 2048, 0, 0)
debug: fbs_Init Enumerate_Plugs()
debug: _Enumerate_Plugs()
debug: _Enumerate_Plugs() call _initplugout(../bin/fbsound-mm-64.dll)
debug: _InitPlugout(../bin/fbsound-mm-64.dll)
debug: _InitPlugout: dylibload(../bin/fbsound-mm-64.dll)
debug: _plug_mm_init() constructor
debug: mm: plug_isany
debug: _Enumerate_Plugs() call _initplugout(../bin/fbsound-ds-64.dll)
debug: _InitPlugout(../bin/fbsound-ds-64.dll)
debug: _InitPlugout: dylibload(../bin/fbsound-ds-64.dll)
debug: ds: plug_ds_init()
debug: ds: CoInitialize()
debug: ds: plug_isany()
debug: ds: DS_DEVICE_DESCRIPTOR()
debug: mm: plug_init()
debug: mm: MMInit()
debug: mm: plug_init~
debug: FBS_Init set CPU pointers !
debug: FBS_Start()
debug: mm: plug_start()
debug: mm: WriteThread()
debug: mm: FillThread()
debug: _MP3StreamingThread()
playing ../data/legends.mp3 press any key ...
Last edited by D.J.Peters on Oct 21, 2020 11:36, edited 1 time in total.
D.J.Peters
Posts: 8586
Joined: May 28, 2005 3:28
Contact:

Re: preview: of fbsound 1.2 (dynamic) Windows/Linuxt (sid wav mp3 ogg mod it xm s3m)

Post by D.J.Peters »

I added "How to compile fbsound 1.2 !" see first post.

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

Re: preview: of fbsound 1.2 (dynamic) Windows/Linuxt (sid wav mp3 ogg mod it xm s3m)

Post by D.J.Peters »

I added a second note about the fbsound 1.2 output drivers (see first post)

Joshy
Roland Chastain
Posts: 993
Joined: Nov 24, 2011 19:49
Location: France
Contact:

Re: preview: of fbsound 1.2 (dynamic) Windows/Linuxt (sid wav mp3 ogg mod it xm s3m)

Post by Roland Chastain »

@D.J.Peters

Thank you for your work on the library and on the documentation. I can't wait to make a new test. :)
D.J.Peters wrote:How do you setup fbc 32 and 64 bit on the 64-bit PC ?
I downloaded a Linux 32 package from /stw/builds, and installed one after one the missing libraries (the dev version). The missing libraries were named in error messages when I tried to start the compiler. The ldd command was also useful:

ldd /home/roland/Applications/fbc_linux32/bin/fbc

I had to configure my package manager, so that 32-bit versions of libraries appear in the results of my search.

It was on Linux Mageia. I also tried on Manjaro, but I gave up, because installation of 32-bit libraries was more complicated.

P.-S. I didn't really install the compiler: I just uncompressed it somewhere and call it with a script.

fbc32=/home/roland/Applications/fbc_linux32/bin/fbc
$fbc32 mysource.bas
D.J.Peters
Posts: 8586
Joined: May 28, 2005 3:28
Contact:

Re: preview: of fbsound 1.2 (dynamic) Windows/Linuxt (sid wav mp3 ogg mod it xm s3m)

Post by D.J.Peters »

What first version of fbsound was in 2005, can't believe it !
Who has stolen from me in the last 15 years ?
Maybe FreeBASIC, must be a real love affair. :lol:

Joshy
Roland Chastain
Posts: 993
Joined: Nov 24, 2011 19:49
Location: France
Contact:

Re: preview: of fbsound 1.2 (dynamic) Windows/Linuxt (sid wav mp3 ogg mod it xm s3m)

Post by Roland Chastain »

There is a typo in build scripts: pendantic instead of pedantic.
D.J.Peters
Posts: 8586
Joined: May 28, 2005 3:28
Contact:

Re: preview: of fbsound 1.2 (dynamic) Windows/Linuxt (sid wav mp3 ogg mod it xm s3m)

Post by D.J.Peters »

Roland Chastain wrote:There is a typo in build scripts: pendantic instead of pedantic.
good find you must be a pedantic person :lol:

I wonder why fbc accept it wrong written ?

Joshy
Roland Chastain
Posts: 993
Joined: Nov 24, 2011 19:49
Location: France
Contact:

Re: preview: of fbsound 1.2 (dynamic) Windows/Linuxt (sid wav mp3 ogg mod it xm s3m)

Post by Roland Chastain »

D.J.Peters wrote:
Roland Chastain wrote:There is a typo in build scripts: pendantic instead of pedantic.
good find you must be a pedantic person :lol:
Yes. :)
D.J.Peters wrote:I wonder why fbc accept it wrong written ?
Answer here:
viewtopic.php?p=276419#p276419
Roland Chastain
Posts: 993
Joined: Nov 24, 2011 19:49
Location: France
Contact:

Re: preview: of fbsound 1.2 (dynamic) Windows/Linuxt (sid wav mp3 ogg mod it xm s3m)

Post by Roland Chastain »

With the binaries included in the package, the library works, excepted fbs_Set_PlugPath(). With the library compiled by myself, nothing works, even with the binaries in the current directory. I must have done something wrong.

debug: _InitPlugout: can't load 'libfbsound-alsa-32.so' !
debug: fbs_Init: no playback devices !


I commented #define DEBUG in /fbsound-1.2-src/inc/fbstypes.bi and in /fbsound-1.2/inc/fbsound-dynamic.bi, but DEBUG still seems to be defined. It makes compilation error in my code.

I copied this from /fbsound-1.2-src/inc/fbstypes.bi to /fbsound-1.2/inc/fbsound-dynamic.bi (or the reverse, I don't remember), because you said that the same options were needed in both files. Maybe It wasn't a good idea.

Code: Select all

' linux
#ifdef __FB_LINUX__
 #ifndef __FB_64BIT__
  #define NO_PLUG_DSP
  #define NO_PLUG_ARTS
 #endif  
'#define NO_PLUG_ALSA 
#endif
I will make another attempt later.
Roland Chastain
Posts: 993
Joined: Nov 24, 2011 19:49
Location: France
Contact:

Re: preview: of fbsound 1.2 (dynamic) Windows/Linuxt (sid wav mp3 ogg mod it xm s3m)

Post by Roland Chastain »

Roland Chastain wrote:With the binaries included in the package, the library works, excepted fbs_Set_PlugPath(). With the library compiled by myself, nothing works, even with the binaries in the current directory. I must have done something wrong.
It was a stupid error. My app changed directory before I initialize fbSound. I changed that, and now it works.

P.-S. But still the same error with fbs_Set_PlugPath()... Fortunately, it isn't really important. (If you wonder, yes, I made the modification that you indicated.)
Post Reply