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
lizard
Posts: 440
Joined: Oct 17, 2017 11:35
Location: Germany

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

Post by lizard »

All tests working here on Mint 18.3 xfce 64 bit. Most i like "fbs_get_playingsounds_ogg.bas" with the fractals. Really nice work!
D.J.Peters
Posts: 8586
Joined: May 28, 2005 3:28
Contact:

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

Post by D.J.Peters »

lizard wrote:All tests working here on Mint 18.3 xfce 64 bit.
Good to know :-)

Joshy
badidea
Posts: 2586
Joined: May 24, 2007 22:10
Location: The Netherlands

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

Post by badidea »

I had to install some additional 'libasound' libraries, but I hear sound now! Thanks!
Fbc 1.04.0 32-bit, Ubuntu Mate 16.04 64-bit.
I'll run all the tests later today...

Edit: All examples run as expected.
Last edited by badidea on Apr 21, 2018 22:01, edited 1 time in total.
Roland Chastain
Posts: 993
Joined: Nov 24, 2011 19:49
Location: France
Contact:

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

Post by Roland Chastain »

Thank you Joshy and congratulations for the new release of fbsound. Works perfectly here (Windows 10 64, FBC 1.05.0 for Win32).
Roland Chastain
Posts: 993
Joined: Nov 24, 2011 19:49
Location: France
Contact:

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

Post by Roland Chastain »

I would like to include in a project only the necessary files to load and play a WAV sound. So I tried this code:

Code: Select all

#define NODSP
#define NOMOD
#define NOMP3
#define NOOGG
#include once "fbsound\inc\fbsound.bi"
But if I delete, for example, the lib\win32\libfbsdsp.a file, I get this error:
C:\FBC\1.05.0\bin\win32\ld.exe: cannot find -lfbsdsp
Is it normal?
D.J.Peters
Posts: 8586
Joined: May 28, 2005 3:28
Contact:

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

Post by D.J.Peters »

@badidea thank you for testing :-)

@Roland set your defines in fbsstypes.bi
and recompile the library.
Should work so far I know :-)

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

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

Post by Roland Chastain »

D.J.Peters wrote:@Roland set your defines in fbsstypes.bi
and recompile the library.
Should work so far I know :-)
Works perfectly, thank you.
BasicCoder2
Posts: 3906
Joined: Jan 01, 2009 7:03
Location: Australia

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

Post by BasicCoder2 »

Although the program compiled and ran ok I did get this warning?
Beautiful demo.

Command executed:
"C:\FreeBasic\fbc.exe" "E:\fbsound-1.0\tests\fbs_get_playingsounds_mp3.bas"

Compiler output:
E:\fbsound-1.0\tests\fbs_get_playingsounds_mp3.bas() warning 20(2): Object files or libraries with mixed multithreading (-mt) options, ../lib/win32\libfbscpu.a

Results:
Compilation successful
Generated executable: E:\fbsound-1.0\tests\fbs_get_playingsounds_mp3.exe

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)
Roland Chastain
Posts: 993
Joined: Nov 24, 2011 19:49
Location: France
Contact:

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

Post by Roland Chastain »

@BasicCoder2

The warning is expected. If you want to get rid of it, you can compile with "-mt" option.
D.J.Peters
Posts: 8586
Joined: May 28, 2005 3:28
Contact:

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

Post by D.J.Peters »

lizard wrote:Most i like "fbs_get_playingsounds_ogg.bas" with the fractals. Really nice work!
Thank you it's my favorite in many reasons also.
1) "2005" It was my first successful go in FreeBASIC inline assembler.
2) Legends of the fall are not a part of my all stars top 10 movies but the soundtrack it's so beauty to me.
3) My favorite movie soundtrack composer "James Horner" are gone for ever.
4) If I'm drunken and I miss him as my favorite composer than I watch this short Mandelbrot tribute.

I'm become a little bit sad again what a f***.

@BasicCoder2 take a short look at: https://www.freebasic.net/wiki/wikka.ph ... pilerOptmt

Sometimes I think it would be a great feature if the first and only the first line of source code
are reading by the compiler as optional command line arguments.

Joshy

Like this:

Code: Select all

command-line: -lang fb gen gcc -O2 -mt -asm intel
print "How cool is that :-)"
sleep
lizard
Posts: 440
Joined: Oct 17, 2017 11:35
Location: Germany

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

Post by lizard »

D.J.Peters wrote:I'm become a little bit sad again what a f***.
Simply replace the soundfile with this and be ...

https://www.youtube.com/watch?v=KnYjQHkHnD8

... happy! :-)
D.J.Peters
Posts: 8586
Joined: May 28, 2005 3:28
Contact:

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

Post by D.J.Peters »

lizard wrote:Simply replace the soundfile with this and be ...
His music don't make me sad, my favorite composer died that was the point.

But it's OK i'm happy again :-)

Joshy
badidea
Posts: 2586
Joined: May 24, 2007 22:10
Location: The Netherlands

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

Post by badidea »

May I ask a short question here?

How do I check that a sound object is being played?
E.g. On press "h", I want to sound a horn, but only if the horn is not already active.
D.J.Peters
Posts: 8586
Joined: May 28, 2005 3:28
Contact:

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

Post by D.J.Peters »

Good question there isn't a fbs_Get_SoundStatus() command

but If only one sound are playing you can use fbs_Get_PlayingSounds()
if the result are 0 then there are no playing sounds currently.

but you can get the loop counter:
Play the sound with a loop counter of 1 (normal one playback)
dim as integer nLoops
...
fbs_Get_SoundLoops(hSound, @nLoops)
if nLoops=0 then fbs_Play_Sound(hSond,1)

Or do it like a boss :-)
get the sound pointers and compare current play position with the start position:
if play position = start position then fbs_Play_Sound(hSound)

pPlay=pStart means it was never played or it was played
but on end of the sound the play position are reset to it's start position
for the next fbs_Play_Sound() command.

dim as short ptr pStart,pPlay
...
fbs_Get_SoundPointers(hSound, @pStart, @pPlay)
if pPlay=pStart then fbs_Play_Sound(hSound)

Let me know if you need a short example.

Joshy
badidea
Posts: 2586
Joined: May 24, 2007 22:10
Location: The Netherlands

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

Post by badidea »

D.J.Peters wrote:...
Thanks, I was already on the right track apparently.

With fbs_Play_Sound(hSound, 1):
fbs_Get_SoundLoops(hSound, @nLoops) seems do do the job for me most convenient. Before 0, during 1, ended 0
fbs_Get_SoundPosition(hSound, @sPos) requires a rewind, otherwise: Before 0.0, during 0.0 ... 1.0, ended 1.0
I did not try the other options.

Code: Select all

function my_fbs_Sound_playing(hSound as integer) as boolean
	dim as integer nLoops
	fbs_Get_SoundLoops(hSound, @nLoops)
	if nLoops = 0 then return false
	return true
end function
Post Reply