fbsound 1.2 Windows/Linux (sid wav mp3 ogg mod it xm s3m)

External libraries (GTK, GSL, SDL, Allegro, OpenGL, etc) questions.
D.J.Peters
Posts: 8299
Joined: May 28, 2005 3:28
Contact:

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

Postby D.J.Peters » Oct 21, 2020 18:42

New build uploaded see first post
The Windows build is final now !
only Linux -g is enabled for a gdb session and debug infos.
(I'm working on a solution but currently DylibFree() on Linux is the primary problem)

fbs_Set_PlugPath() is working now !

That means the the sound drivers:
fbsound-mm-32.dll fbsound-ds-32.dll
fbsound-mm-64.dll fbsound-ds-64.dll
libfbsound-alsa-32.so libfbsound-alsa-64.so
can be in any folder

Ofcourse the fbsound-1.2 libraray it self must be loadable from your compiled program !
fbsound-32.dll fbsound-64.dll
libfbsound-32.so fbsound-64.so

The simplest solution on Windows and Linux are put the library in the same folder as your application.

I self publish my game as a single folder solution for Windows and Linux here are the folder structure I use:

gametitle.zip

gametitle/game.ini
gametitle/media/ ' 3D models, sounds, images and fonts
gametitle/plugs/ ' Linux and Windows fbsound drivers
gametitle/game-32.exe ' compiled 32-bit Windows app
gametitle/game-64.exe ' compiled 64-bit Windows app
gametitle/game-32 ' compiled 32-bit Linux app
gametitle/game-64 ' compiled 64-bit Linux app
gametitle/fbsound-32.dll
gametitle/fbsound-64.dll
gametitle/libfbsound-32.so
gametitle/libfbsound-64.so

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

Re: fbsound 1.2 Windows/Linux (sid wav mp3 ogg mod it xm s3m)

Postby D.J.Peters » Oct 21, 2020 18:57

was off toppic :-)
Last edited by D.J.Peters on Oct 23, 2020 11:29, edited 1 time in total.
UEZ
Posts: 729
Joined: May 05, 2017 19:59
Location: Germany

Re: fbsound 1.2 Windows/Linux (sid wav mp3 ogg mod it xm s3m)

Postby UEZ » Oct 23, 2020 10:15

@Joshy: is a possible to have only as small as possible DLL which plays SID files only? I'm using TitchySID.dlll (16 kb) which supports only x86 code execution.

Thanks. :-)
dafhi
Posts: 1382
Joined: Jun 04, 2005 9:51

Re: fbsound 1.2 Windows/Linux (sid wav mp3 ogg mod it xm s3m)

Postby dafhi » Oct 25, 2020 1:26

SID playback as expertly as you have done here is to be commended. Busy with my own projects as usual though =)

regards
adeyblue
Posts: 69
Joined: Nov 07, 2019 20:08

Re: fbsound 1.2 Windows/Linux (sid wav mp3 ogg mod it xm s3m)

Postby adeyblue » Nov 21, 2020 1:51

Is there a route for useful libraries like this to be included with the official distribution?

There seems to be semi-regular attempts to make lists of 'here's where the good things on the forum are', when some of the things that are always mentioned, commonly recommended for tasks, or are plain useful could just as well be bundled along with the compiler.
wio
Posts: 17
Joined: Feb 05, 2021 4:58

Re: fbsound 1.2 Windows/Linux (sid wav mp3 ogg mod it xm s3m)

Postby wio » May 05, 2021 15:05

Hi,

I am using fbsound and have no problems whatsoever when running it with the onboard (motherboard) sound.
It doesn't seem to work when used with a USB soundcard though. I can have a blank project with just an fps counter and as soon as I enable the sound it dies a death and goes from around 900fps to about 30. I don't see this as an issue specific to fbsound because I have tried other sound libraries including fmod, AFlib and BASS, all have the same results of hammering my computer.

I have a Behringer UMC202HD and a friend of mine has a Mackie Big Knob and he gets the same issue, solved by disabling the USB sound card.
If I play around with the latency settings on the ASIO audio driver for the USB card I can get slightly better results but it is extremely glitchy and running hundreds of fps slower than with onboard sound.

I can and have always been able to play games and other apps using an external soundcard, without having to change any drivers or settings and I have never had to disable it and go with the onboard sound until I started using FreeBasic. So, my question is, does anybody have any idea how I can get these external cards to work with FreeBasic?

Any help or ideas are greatly appreciated. Kind regards.

EDIT: I sort of fixed it by changing the ASIO sample buffer size to 8 samples in the sound card utility. Is there any way to set the sample buffer size from freebasic? I wonder if that is how other apps/games are able to use the sound card with no issues...
D.J.Peters
Posts: 8299
Joined: May 28, 2005 3:28
Contact:

Re: fbsound 1.2 Windows/Linux (sid wav mp3 ogg mod it xm s3m)

Postby D.J.Peters » May 06, 2021 7:52

@wio I'm a musican and have many sound devices that support the ASIO standard.
First what I can tell you is the fact that fbsound doesn't use any ASIO driver
that means changing any ASIO buffer size has no effect on fbsound !

Normally the ASIO driver should be inactive if an app use the OS audio driver.

Maybe the ASIO driver on your box is permanently active ?

Of course you can set or change the number of buffers and buffer size with the init command of fbsound.

Joshy
wio
Posts: 17
Joined: Feb 05, 2021 4:58

Re: fbsound 1.2 Windows/Linux (sid wav mp3 ogg mod it xm s3m)

Postby wio » May 06, 2021 18:30

Hi Joshy,

Thanks for the reply. I also make music :D

Changing the 'Preferred ASIO Buffer Size' to 8 samples in my USB sound card control panel definitely solves my problems when using freebasic, with any sound library, not just fbsound. So yes, I guess only the ASIO driver is being used and any sounds are played/mapped through that driver. There is no way to change it in the Sound card control panel, only by using my DAW. The thing is, I never have any problems with any other software playing sounds through it.
I can select to use the Direct Sound Driver if I open my DAW (Reaper or Cubase) but the sound card defaults to the ASIO driver if I don't change it manually in the DAW. It runs ok with the DAW open and Direct Sound Driver used but crashes if I try to use fbs_Init whilst having the DAW open. As soon as I close the DAW, it goes back to using the ASIO driver again.

I have tried using

Code: Select all

'fbs_Init([nRate],[nChannesl],[nBuffers],[nFrames],[nPluinIndex],[nDevceIndex])
fbs_Init(44100,2,3,2048)

I tried changing the number of frames per buffer (nFrames) to 8 but it won't go below 1024 without hanging. However, I don't think that corresponds to the number of samples in the 'Preferred ASIO Buffer Size' anyway because it doesn't change anything in my Behringer control panel.

The sample rate of my Behringer sound card changes from it's default setting of 48000 to 44100 when I use the fbs_Init command (as above) so it is definitely affecting the ASIO driver.

I mean, I could ignore the problem and put in my release notes that if you run my game on an ASIO driver, it might not function properly unless you lower the buffer size samples to 8. It's not a problem leaving the setting at 8 samples until I come to do some audio work again, 8 samples is probably a bit too low and glitchy for recording work and is definitely nowhere near high enough for when mixing down etc.
Even though I know these cards are semi-pro audio cards, not gaming cards, it's still a bit disappointing.

I wonder how other apps control the sound card behaviour if an ASIO driver is running, it's bugging me but it's not a complete game breaker I suppose.

By the way, thanks for all the help you give on the forums, you are very knowledgeable and very much appreciated.

EDIT: I just tested a couple of games and they don't seem to be affected by changing the samples in my USB sound card control panel, this suggests that the games are maybe forcing the use of direct sound drivers instead of the ASIO driver. Do you know of any way to do that with fbsound and/or freebasic?

Kind regards, Dan.
Last edited by wio on May 06, 2021 20:57, edited 1 time in total.
wio
Posts: 17
Joined: Feb 05, 2021 4:58

Re: fbsound 1.2 Windows/Linux (sid wav mp3 ogg mod it xm s3m)

Postby wio » May 06, 2021 20:55

Hi, me again :D

Something else I just tried and don't quite understand...

Code: Select all

'fbs_Init([nRate],[nChannesl],[nBuffers],[nFrames],[nPluinIndex],[nDevceIndex])
fbs_Init(44100,2,3,2048,0,2)


USING BEHRINGER EXTERNAL USB CARD
With this sound card active I can select nDevceIndex = 0 or nDevceIndex = 2 and get sound coming out. If I change it to 2, it works great and I get no lagging. (I tried changing the device index from 0 to 1 but this causes a hang on fbs_init.) The strange thing is I only have 2 sound devices in my machine and both 0 and 2 seem to be working for this sound device. When I use nDevceIndex = 2 it doesn't cause any issues but if I use nDevceIndex = 0, I lose my frame rate again.

USING ONBOARD SOUND
Device 0 works but no other device numbers work when using onboard sound (hangs at fbs_init).

What is being selected in nDevceIndex, Is it the physical sound device in my machine?
D.J.Peters
Posts: 8299
Joined: May 28, 2005 3:28
Contact:

Re: fbsound 1.2 Windows/Linux (sid wav mp3 ogg mod it xm s3m)

Postby D.J.Peters » May 07, 2021 4:10

first try file "fbs_init_second_plugin.bas"

with all this settings:

ok=fbs_Init(4100,2,3,2048,0,0) ' first sound device with first fbsound driver
than
ok=fbs_Init(4100,2,3,2048,0,1) ' first sound device with second fbsound driver
than
ok=fbs_Init(4100,2,3,2048,1,0) ' second sound device with first fbsound driver
at least
ok=fbs_Init(4100,2,3,2048,2,0) ' second sound device with second fbsound driver

what does "fbs_init_second_plugin.bas" reports ?

if you try for example the third sound device=2 and fbsound can't find it while not exists
fbsound will try an other working 0=first or 1=second device !

be sure your onboard sound device does not make trouble

try to disable the onboard device may be in the BIOS and see what happent with the other sound device !

joshy
wio
Posts: 17
Joined: Feb 05, 2021 4:58

Re: fbsound 1.2 Windows/Linux (sid wav mp3 ogg mod it xm s3m)

Postby wio » May 07, 2021 20:53

Hi, thanks for getting back. These are the results...

With BEHRINGER external USB card selected as the current audio device (win10)
using (44100,2,3,2048,0,0)
init second pugin
OK
Plugout : mm
Hardware output device : Speakers (2- BEHRINGER UMC 202H
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

using (44100,2,3,2048,0,1)
init second pugin
OK
Plugout : mm
Hardware output device : Speakers (High Definition Audio
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

using (44100,2,3,2048,1,0)
init second pugin
OK
Plugout : mm
Hardware output device : Speakers (2- BEHRINGER UMC 202H
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

using (44100,2,3,2048,2,0)
init second pugin
OK
Plugout : mm
Hardware output device : Speakers (2- BEHRINGER UMC 202H
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


With Onboard Sound (High Definition Audio) selected as the current audio device (win10)
using (44100,2,3,2048,0,0)
init second pugin
OK
Plugout : mm
Hardware output device : Speakers (High Definition Audio
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

using (44100,2,3,2048,0,1)
init second pugin
OK
Plugout : mm
Hardware output device : Speakers (2- BEHRINGER UMC 202H
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

using (44100,2,3,2048,1,0)
init second pugin
OK
Plugout : mm
Hardware output device : Speakers (High Definition Audio
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

using (44100,2,3,2048,2,0)
init second pugin
OK
Plugout : mm
Hardware output device : Speakers (High Definition Audio
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

:)

EDIT: Oops I forgot to try disabling my onboard soundcard in BIOS, will try it now...
wio
Posts: 17
Joined: Feb 05, 2021 4:58

Re: fbsound 1.2 Windows/Linux (sid wav mp3 ogg mod it xm s3m)

Postby wio » May 07, 2021 21:30

After disabling onboard audio, all the test results were the same as below

init second pugin
OK
Plugout : mm
Hardware output device : Speakers (2- BEHRINGER UMC 202H
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

Also, with onboard sound disabled and with the number of samples set to 8 in Preferred ASIO Buffer Size on the Behringer control panel is still the only way to avoid the really bad lag (from 900fps to 32fps). Even though it says 'ASIO not active', changing the buffer size above 8 is most definitely causing big problems. Strange.
Image

Return to “Libraries”

Who is online

Users browsing this forum: Google [Bot] and 2 guests