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.
badidea
Posts: 2154
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 13:08

I did some tests (copy to /usr/lib, chmod +x, etc.), no change.
But with "../inc/fbsound.bi" I get:
fbc64 fbs_load_mod.bas
./libfbsound-64.so: undefined reference to `logf@GLIBC_2.27'
./libfbsound-64.so: undefined reference to `expf@GLIBC_2.27'


So, I need to update stuff here it seems:
ldd --version
ldd (Ubuntu GLIBC 2.23-0ubuntu10) 2.23
D.J.Peters
Posts: 8190
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)

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

./libfbsound-64.so: undefined reference to `logf@GLIBC_2.27'
./libfbsound-64.so: undefined reference to `expf@GLIBC_2.27'

Yes this is the problem if the dynamic loader can't resolve all open references it must fail.

logf() and and expf() are the float version of exp() and log() the double version I'm using in fbsound.

Normally it's a part of the C- runtime and should be available on all systems.

Why your GLIBC_2.27 can resolve cosf() and sinf() but not logf() and expf() I don't know ?

I use log() here:

Code: Select all

public _
function fbs_Volume_2_DB(byval volume as single) as single API_EXPORT
  return 20.0f*log(volume)/log(10)
end function
sin() and exp() here:

Code: Select all

sub _Set_EQFilter(byval lpFilter as fbs_filter ptr, _
                  byval Center   as single       , _
                  byval dB       as single = 0.0 , _
                  byval Octave   as single = 1.0 , _
                  byval Rate     as single = 44100.0)

  dim as single Phase,Scale,SinPhase,SinhTerm,e1,e2,Speed,SmS,SdS,SS

  Phase = PI2 * (Center / Rate)
  Scale = fbs_DB_2_Volume(dB)
  SinPhase=sin(Phase)
  SinhTerm=Phase / SinPhase
  SinhTerm=0.34657359f * Octave * SinhTerm
  e1=exp( sinhterm)
  e2=exp(-sinhterm)
  sinhterm=(e1-e2)*0.5
  Speed = SinPhase * sinhterm
 
  SmS = Speed*Scale
  SdS = Speed/Scale
  SS = 1.0f / (1.0f + SdS)

  lpFilter->Center=Center
  lpFilter->dB=dB
  lpFilter->Octave=Octave
  lpFilter->Rate=Rate
  lpFilter->Scale=Scale
  lpFilter->b0 = SS*( 1.0f + SmS)
  lpFilter->b1 = SS*(-2.0f * cos(Phase))
  lpFilter->b2 = SS*( 1.0f - SmS)
  lpFilter->a1 = -(lpFilter->b1)
  lpFilter->a2 = SS*((SdS) - 1.0f)
  lpFilter->x1_l=0.0f
  lpFilter->x2_l=0.0f
  lpFilter->y1_l=0.0f
  lpFilter->y2_l=0.0f
  lpFilter->x1_r=0.0f
  lpFilter->x2_r=0.0f
  lpFilter->y1_r=0.0f
  lpFilter->y2_r=0.0f
end sub
D.J.Peters
Posts: 8190
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)

Postby D.J.Peters » Dec 24, 2018 14:35

Another point are why your GLIBC_2.27 can resolve logf() and expf()
in libfbsound-32.so and fails in libfbsound-64.so both are compiled with -gen gcc.

Is your 32-bit GLIBC a other version as 2.27 ?

How ever to run not in this kind of problems I create all C/C++ libraries for FreeBASIC with the "-static" command line option.
In this case all runtime functions are linked in the shared libraries and there are no dependencies to the runtime of the target host.

Other "big" packages do the same "trick" for example the binary version of FireFox or Opera run's on most of all Linux versions
without any open references.

Joshy
badidea
Posts: 2154
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 15:10

badidea wrote:ldd (Ubuntu GLIBC 2.23-0ubuntu10) 2.23

2.23 not 2.27

I don't know (yet) how to check the 32-bit version of glibc

Edit: libc6:i386 installed version 2.23-0ubuntu10 (assuming libc = glibc)

So I don't know why the difference between 64 bit and 32-bit.
Pitto
Posts: 119
Joined: Nov 19, 2012 19:58

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

Postby Pitto » Dec 26, 2018 9:31

Hi Joshy,

I've tested in WIN 10 64 bit and Linux Ubuntu 64 bit. The dynamic lib works very fine.
I've compiled and executed the "oop" test with no problem. Even adding the lib to my projects has been really easy.
I've easily added music to my "A love letter to freebasic" project, and now it seems really better.

In Raspberry PI 3 (Raspian 2.3) I've a problem:
I compile the examples, but, even if the library files are in the project folder, I get this error message "lib-fbsound 32 not loaded".
I tried to place "lib-fbsound32.o" also in /usrl/lib and usr/local/lib, but the error remains.

Image

I'm not an expert on Linux. Where I'm going wrong?

Anyway best regards for your very good job.
D.J.Peters
Posts: 8190
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)

Postby D.J.Peters » Dec 26, 2018 17:41

Pitto thank you for testing.

The primary part of fbsound is x86 and x86-64 inline assembler code
but Raspberry PI and Beaglebone are ARM devices and not supported ATM.
May be in 2019 I will learn ARM assembler for my CNC router project.

Joshy

By the way on Friday I start with my love letter stuff from my point of view
a "FreeBASIC" love letter should run on all FB supported platforms.
The first line will be:

Code: Select all

#include once "Config.bi"
file "Config.bi":

Code: Select all

#ifndef __Config_bi__
#define __Config_bi__

#ifndef __NO_ASM__
 #ifdef __FB_ARM__
  #define __NO_ASM__
 #endif
#endif

#ifndef __NO_AUDIO__
 #if defined(__FB_ARM__) or defined(__FB_DOS__)
  #define __NO_AUDIO__
 #endif
#endif

#ifndef __NO_ASM__
 #ifndef __FB_64BIT__
  #define REG_SIZE 4
  #define PTR_SIZE DWORD
  #define XBP ebp
  #define XDI edi
  #define XSI esi
  #define XSP esp
 #else
  #define REG_SIZE 8
  #define PTR_SIZE QWORD
  #define XBP rbp
  #define XDI rdi
  #define XSI rsi
  #define XSP rsp
 #endif
#endif

#endif __Config_bi__
Pitto
Posts: 119
Joined: Nov 19, 2012 19:58

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

Postby Pitto » Dec 27, 2018 12:34

Hi,

I've tested the dynamic library also on old hardware (Win Xp SP2 Intel Celeron @ 2.00 Ghz, 256 Mb Ram).
I've compiled and executed "oop_test01.bas": it works fine.

Best regards
leopardpm
Posts: 1795
Joined: Feb 28, 2009 20:58

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

Postby leopardpm » Jan 02, 2019 6:52

I am such an bright trying to install these things....
so, I have:

Windows 10, 64 bit OS

System:
FBIde: 0.4.6
fbc: FreeBASIC Compiler - Version 1.05.0 (01-31-2016), built for win32 (32bit)
OS: Windows NT 6.2 (build 9200)

I downloaded fbsound 1.1.zip
extracted it into my FreeBasic folder (where the compiler is)

I go into the fbsound folder, found the 'tests' sub-folder, found the program "fbs_load_and_play_wav.bas"
(C:\Program Files (x86)\FreeBASIC\fbsound-1.1\tests)
and load it up into my FBide and Run it - it works....

but when I "Save As" into where I keep my FB projects
(C:\Users\RMS\Documents\FreeBasic Projects)
it will not run and gives me:
error: lib fbsound-32 not loaded

and then quits.

Where do I need to move things around so I can use this library... AND, once I compile a final EXE file, will I need to have some other files tag along with it for it to work correctly on another system without FB or anything on it?

I don't know how I got FBimage to work, but I lose so much time messing with this 'behind the scenes' stuff that it is very frustrating...I all I want to do is play a stupid WAV file in my program, can't believe its so difficult to do.....

forgive my inability... I go for months or even years without touching FB then get into it again, and I have since forgotten the arcane steps involved in doing these sort of things...

...and question #2: is the fact that my OS is 64bit yet I am running the FBC for 32bit a problem as well? I seem to be able to copy/paste programs off the forum pretty well, in most instances, without I problem...
Pitto
Posts: 119
Joined: Nov 19, 2012 19:58

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

Postby Pitto » Jan 02, 2019 7:28

Hi,

see this, it is a previous post by 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.

leopardpm
Posts: 1795
Joined: Feb 28, 2009 20:58

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

Postby leopardpm » Jan 02, 2019 8:03

hmmm... ok I copied everything into the same folder... it worked.... then I started deleting things one at a time and testing...

these TWO files are both required in same folder for it to work:

Code: Select all

fbsound-32.dll
plug-mm-32.dll


and this file needs to in the FreeBasic 'inc' folder

Code: Select all

fbsound_dynamic.bi
leopardpm
Posts: 1795
Joined: Feb 28, 2009 20:58

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

Postby leopardpm » Jan 02, 2019 9:23

thank you, Pitto - I REALLY appreciate it!

now for my LAST stupid question (for today...)... is there a way to change/set the playback volume (for WAV files in particular....)?

lookedthru all the example files in the 'tests' folder, didn't see anything about volume....
D.J.Peters
Posts: 8190
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)

Postby D.J.Peters » Jan 02, 2019 11:04

You can set the volume if you execute FBS_Play_Wave

Code: Select all

declare function FBS_Play_Wave(byval hWave    as integer        , _
                               byval nLoops   as integer  = 1   , _
                               byval Speed    as single  = 1.0 , _
                               byval Volume   as single  = 1.0 , _
                               byval Pan      as single  = 0.0 , _
                               byval phSound  as integer ptr = NULL) as boolean
Or if you play it as a sound object with FBS_Set_SoundVolume

Code: Select all

declare function FBS_Set_SoundVolume(byval hSound as integer , _
                                     byval Volume as single) as boolean
In the case of the tiny OOP interface you can use the property Volume of the SoundBuffer

Code: Select all

declare property Volume(byval newVolume as single)
leopardpm
Posts: 1795
Joined: Feb 28, 2009 20:58

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

Postby leopardpm » Jan 02, 2019 14:19

nice- thank you for all your hard work... played with sounds for awhile last night and they are so necessary. This library should be part of FB distribution
leopardpm
Posts: 1795
Joined: Feb 28, 2009 20:58

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

Postby leopardpm » Jan 08, 2019 18:13

Joshy,
I am using both WAV files and OGG files... is there an easy way to convert OGG to a WAV file?

I would rather have all the same file type for loading/playing etc....

EDIT: Found an online converter, that will work for me... sorry to bother you
badidea
Posts: 2154
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 » Jan 08, 2019 20:29

Creating a WAV-file (from data in memory) does not seem too hard: http://soundfile.sapp.org/doc/WaveFormat/

Return to “Libraries”

Who is online

Users browsing this forum: No registered users and 4 guests