fbsound 1.0 Win/Lin 32/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.
Post Reply
JKL
Posts: 8
Joined: Jul 02, 2014 15:10

Re: fbSound for Linux x86 Win32 (wav mp3 ogg mod it xm s3m)

Post by JKL »

I downloaded fbsound for the first time a few days ago but haven't been able to get it working. I already had all fbsound's dependencies (rebuildlib_linux.txt) so ran rebuildlib.sh and buildalltests.sh (i'm on xubuntu) and had a look at the first test file. But when i ran it i got:

Code: Select all

ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM H��
ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM H�
ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM H�
error: fbs_Init() !
The characters at the end of the 3 alsa errors change every run. I found the '#define DEBUG' in '<fbsound>/inc/fbstypes.bi', uncommented it and re-ran rebuildlib.sh, as well as compiling test1.bas with:

Code: Select all

fbc -mt -exx -g -w all ./test1.bas
the output to ./test1 (if it's any help) was:

Code: Select all

debug: fbs:constructor()
debug: cpu:()
debug: FPU TSC CMOV MMX SSE SSEII 
debug: MHz~3092
debug: fbs:init(44100, 2, 3, 2048, 0, 0)
debug: fbs: _Enumerate_Plugs()
debug: Enumerate Plugs:
debug: fbs:_initplugout
debug: alsa:()
debug: alsa:plug_isany
ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM ���	
ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM ���	
ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM ���	
debug: alsa: error: no or free device!
debug: no free devices !
debug: alsa:~
debug: fbs:_initplugout
debug: dsp:()
debug: dsp:plug_isany
debug: dsp:GetDeviceName /dev/dsp
debug: dsp:GetDeviceName /dev/dsp0
debug: dsp:GetDeviceName /dev/dsp1
debug: dsp:GetDeviceName /dev/sound/dsp
debug: dsp:GetDeviceName /dev/sound/dsp0
debug: dsp:GetDeviceName /dev/sound/dsp1
debug: dsp:isany error no free device!
debug: no free devices !
debug: dsp:~
debug: fbs:_initplugout
debug: can't load plugout:/home/william/Downloads/#Programming/FreeBASIC/fbsound0.19/tests/libplug-arts.so!
debug: fbs: _nPlugs=0
error: fbs_Init() !

debug: cpu:~
debug: fbs:destructor~
I'm using freebasic compiler 1.00.0 and fbsound 0.19

Any ideas on what's happening and how to fix it, i really want to get audio working in freebasic.
Thanks for the help.
D.J.Peters
Posts: 8586
Joined: May 28, 2005 3:28
Contact:

Re: fbSound for Linux x86 Win32 (wav mp3 ogg mod it xm s3m)

Post by D.J.Peters »

I self have only three boxes with Slackware here so I asked angros47 here may be he kows to solve a problem on (x)ubuntu.
Can be that snd_pcm_open_noupdate are deprecated.

Please post the content of file alsa.conf looks like the device name are changed.


google: snd_pcm_open_noupdate xubuntu

Joshy

no problems here with latest ALSA lib:
Slackware 14.1 wrote:bash-4.2$ cd fbsound0.19
bash-4.2$ chmod +x rebuildlib.sh
bash-4.2$ ./rebuildlib.sh
build cpu layer
build fbsound
build plug alsa
build plug dsp
build plug arts
copy *.so to ./tests
ready!

bash-4.2$ chmod +x buildalltests.sh
bash-4.2$ ./buildalltests.sh
please wait build all 44 tests !
ready!

bash-4.2$ cd tests
bash-4.2$ ./test01
Plugout : ALSA
Hardware output device : default
Samplerate : 44100
Bits per sample : 16
Number of channels : 2

Internal Buffersettings
Number of Buffers : 12
Buffersize in bytes : 2048
Number of Frames : 512
Framesize in bytes : 4

[any key] = quit
D.J.Peters
Posts: 8586
Joined: May 28, 2005 3:28
Contact:

Re: fbSound for Linux x86 Win32 (wav mp3 ogg mod it xm s3m)

Post by D.J.Peters »

@JKL put this short plugdevicetest.bas in folder fbsound0.19/tests

file: plugdevicetest.bas

Code: Select all

#include "../inc/fbsound.bi"

const data_path = "../data/"

' only if not same as exe path
' fbs_Set_PlugPath("./")

dim as integer nPlugIndex
dim as integer nDeviceIndex
dim as FBSBOOLEAN ok

while ok=false
  print "try plug " & nPlugIndex & " device " & nDeviceIndex
  ok=fbs_Init(,,,,nPlugIndex,nDeviceIndex)
  if ok=false then
    nDeviceIndex+=1
    if nDeviceIndex=2 then
      nDeviceIndex=0
      nPlugIndex+=1
      if nPlugIndex=3 then exit while
    end if  
  end if
wend
if ok=true then
  ? "OK  fbs_Init()"
else
  ? "error: fbs_Init() !"
  ? FBS_Get_PlugError()
  beep
end if
sleep
open a console and type:
console wrote:cd fbsound0.19
cd tests
fbc -mt plugdevicetest.bas
./plugdevicetest
Joshy
Last edited by D.J.Peters on Feb 10, 2017 1:50, edited 1 time in total.
angros47
Posts: 2328
Joined: Jun 21, 2005 19:04

Re: fbSound for Linux x86 Win32 (wav mp3 ogg mod it xm s3m)

Post by angros47 »

In the file plug-alsa.bi, try changing the lines:

Code: Select all

declare function snd_pcm_open ( _
byval pcm      as snd_pcm_t ptr, _
byval device   as string       , _
byval direc    as integer      , _
byval mode     as integer) as integer
with:

Code: Select all

declare function snd_pcm_open ( _
byval pcm      as snd_pcm_t ptr, _
byval device   as zstring ptr       , _
byval direc    as integer      , _
byval mode     as integer) as integer
In fact, the error occurs when snd_pcm_open is called (snd_pcm_open_noupdate is internally called by snd_pcm_open: refer to https://gitorious.org/alsa/alsa-lib/sou ... /pcm/pcm.c), and tells that it cannot find the device; it should then write the name of the device (returned by GetDeviceName: it can be "default", or "hw:1,0", or "hw:0,0"), but instead it write some garbage, because the string sent to snd_pcm_open is wrong; and the string is wrong because alsa is written in c, and you should pass a C compatible string (in C is a byte pointer, referred by "char *"; in FreeBasic it can be a UBYTE PTR, or a ZSTRING PTR)

Hope this help.
D.J.Peters
Posts: 8586
Joined: May 28, 2005 3:28
Contact:

Re: fbSound for Linux x86 Win32 (wav mp3 ogg mod it xm s3m)

Post by D.J.Peters »

@angros47 thank you for the hint.

In the past zstring ptr and string was the same as param (i used it thousand times for the windows api, xlib etc...)
last changes in FB are the behavior of byval / byref string.

How ever i changed it to const zstring ptr

@JKL download fbsound0.20.zip (see first post) and try again please.

Joshy
JKL
Posts: 8
Joined: Jul 02, 2014 15:10

Re: fbSound for Linux x86 Win32 (wav mp3 ogg mod it xm s3m)

Post by JKL »

Thanks! It works fine now :)
The output to ./test01 is now:

Code: Select all

Plugout                : ALSA
Hardware output device : default
Samplerate             : 44100
Bits per sample        : 16
Number of channels     : 2

Internal Buffersettings
Number of Buffers      : 3
Buffersize in bytes    : 8192
Number of Frames       : 2048
Framesize in bytes     : 4

[any key] =  quit
The first few tests also play the sounds they should.
From @angros47's explanation, I think I understand what fixed it as well, if I ever need to know how to intergrate fb programs with C libs :)
Time to have some fun with fbsound! :)
D.J.Peters
Posts: 8586
Joined: May 28, 2005 3:28
Contact:

Re: fbSound for Linux x86 Win32 (wav mp3 ogg mod it xm s3m)

Post by D.J.Peters »

fbc version 1.1 found a wrong declare (LPCSTR instead of LPSTR) is fixed now.

Joshy
Tyr_Anassazi
Posts: 28
Joined: Jul 01, 2013 15:01
Location: Russia, Novosibirsk
Contact:

Re: fbSound for Linux x86 Win32 (wav mp3 ogg mod it xm s3m)

Post by Tyr_Anassazi »

Joshy, Are you going to make the library supporting for 64-bit systems? I and my fellow have the library perfect work with 32-bit Win/Lin, but now we're working on 64-bit version of our game engine and we have much pain trying to link it in. Is it hard to make it 64-bit?
D.J.Peters
Posts: 8586
Joined: May 28, 2005 3:28
Contact:

Re: fbSound for Linux x86 Win32 (wav mp3 ogg mod it xm s3m)

Post by D.J.Peters »

@Tyr_Anassazi I don't publish a FBSound 64bit version, sorry.
GCC 64-bit inline assember makes no fun anymore.

However for non commercial projects you can use the Bass lib instead.

Joshy
Tyr_Anassazi
Posts: 28
Joined: Jul 01, 2013 15:01
Location: Russia, Novosibirsk
Contact:

Re: fbSound for Linux x86 Win32 (wav mp3 ogg mod it xm s3m)

Post by Tyr_Anassazi »

Ok, thanks. 32-bit version will do.
greenllll
Posts: 57
Joined: Jul 02, 2007 19:33

Re: fbSound for Linux x86 Win32 (wav mp3 ogg mod it xm s3m)

Post by greenllll »

Joshy,
the compiler says:
"ld.exe skipping compatible ./libvorbisfile.a"
"ld.exe cannot find -lfbsound"
...
"ld.exe cannot find -lfbscpu"
and many others.
The program cannot compile due to these errors.
I'm trying to run the same program that worked before, but on a new system with a fresh install of the latest freebasic, and I have all those old ld.exe errors again.

Same code as above:

Code: Select all

#libpath "c:\fb\fbsound0.20\lib\win32"
#include "c:\fb\fbsound0.20\inc\fbsound.bi"
'fbsloop44.wav and shoot.wav, and all the *.bi files are in this program's working folder


dim as integer hbgmusic,HshootSound
dim as FBSBOOLEAN ok
ok=fbs_Init()
?"init";ok
ok=fbs_Load_WAVFile("fbsloop44.wav",@hbgmusic)
?"BG";ok
ok=fbs_Load_WAVFile("shoot.wav",@HshootSound)
?"shoot";ok
fbs_Play_Wave(hbgmusic),2000000000

do 
  if inkey$<>"" then 
    fbs_Play_Wave(HshootSound)
  end if
  loop

sleep


Now previously, I thought that I simply had to move the plug-mm.bi file to c:\fb but that's not solving it this time.
The paths are set right. Should it be mixing up "c:\fb\...\.../libdumb.a when searching for -ldumb" the forward slashes with the backward slashes? Is that the problem? This is Windows 8.
D.J.Peters
Posts: 8586
Joined: May 28, 2005 3:28
Contact:

Re: fbSound for Linux x86 Win32 (wav mp3 ogg mod it xm s3m)

Post by D.J.Peters »

@greenllll Sorry I stopped the development of FBSound, it's dead.

For non commercial projects you can use the Bass lib instead.

I use it self and the dynamic loading version I posted don't need any setup of runtime libs.

It's easy to bublish a demo/game or what ever for Win/Lin 32/64-bit.

yourprogram.zip

/yourprogram
/yourprogram/media/
/yourprogram/win32/
/yourprogram/win64/
/yourprogram/linux32/
/yourprogram/linux64/
/yourprogram/yourprogram-32 <- linux
/yourprogram/yourprogram-64 <- linux
/yourprogram/yourprogram-32.exe
/yourprogram/yourprogram-64.exe

Joshy
FotonCat
Posts: 37
Joined: Nov 26, 2009 11:47
Location: Russia
Contact:

Re: fbSound for Linux x86 Win32 (wav mp3 ogg mod it xm s3m)

Post by FotonCat »

It's very sad to hear that you've discontinued such a good project as FBSound, Joshy.
Maybe eventually somewhere in a world the new library, which can be concurent to your one, will appear. And with x64 support.
Thank you for this library, I've used it for about 4 years!
chung
Posts: 648
Joined: Jan 16, 2010 20:52
Location: France
Contact:

Re: fbSound for Linux x86 Win32 (wav mp3 ogg mod it xm s3m)

Post by chung »

hey !
my midipiano_chung uses fbsound ! as long as it can work as 32 bits apps on 64 bits machines, it will be ok .
just continue maintaining it .
keep on the good job ! :+)
CPT-GrayWolf
Posts: 3
Joined: Oct 22, 2014 13:28
Location: A Colorado Nothingtown

Re: fbSound for Linux x86 Win32 (wav mp3 ogg mod it xm s3m)

Post by CPT-GrayWolf »

If you don't mind. I may pick this up, and try making a new library from scratch, using this as a reference.

It'll take me quite a bit of dissecting to figure out how it works though, because I have no idea.

If I do pick it up, you can expect I'll be making a 64 bit version.
I mean, if I'm going to take the time to pull this apart, and start over, from the ground up, I might as well.


I don't really even know yet though, still thinking about it.
Post Reply