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.
leopardpm
Posts: 1791
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 21:20

badidea wrote:Creating a WAV-file (from data in memory) does not seem too hard: http://soundfile.sapp.org/doc/WaveFormat/
since its just a onetime thing...using an online converter works fine for me.

plus, that page describes the WAV format...would also need the OGG format and then a way to translate from ogg->wav.... too much work for simple tsk me thinks
badidea
Posts: 1401
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 22:20

For creating a WAVE file, see: viewtopic.php?f=7&t=27330
With fbsound, you can probably convert (open) OGG to memory.
Dr_D
Posts: 2376
Joined: May 27, 2005 4:59
Contact:

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

Postby Dr_D » May 21, 2019 22:16

DJ, sorry if this question has already been covered... I missed it, if it was. I've been out of the loop for a while.
Anyway, I'm wondering what is the best approach to use when enabling/disabling an infinitely looping sound? It's a retro game I've been playing with, and the sound is used for a space-ship thruster. When the thrust key is pressed, the volume will be set using distance, when it isn't pressed, the volume is set to 0. I'm getting a popping sound whenever I do this, and I wonder if there is a better approach? At first, I tried to play/stop the sound, but it had the popping artifact, so I tried switching to this method, and the popping persists. It might just be that my PC has a weird driver/hardware. Thanks for any tips or advice. This is the first time I've tried to use FBSound for a complete game.

Code: Select all


      if .thrust>0 then

         dim as vec2f vec = .dirVec*-1
         vec.normalize()
         .prt->spawn_thrust( .model(0).tLines(2).p1+.p, .model(0).tLines(1).p1+.p, .model(0).tLines(3).p1+.p, vec*50, PARTICLE_ENUM.THRUST, fTime + .5 )
         fbs_Set_SoundPan (sound(2), -((cam.p.x-player.p.x)+320)/320)
         fbs_Set_SoundVolume( sound(2), 100-(player.p.dist(cam.transP)/SOUND_FALLOFF_FACTOR) )
         
      else
      
         fbs_Set_SoundVolume( sound(2), 0 )
         
      end if

Dr_D
Posts: 2376
Joined: May 27, 2005 4:59
Contact:

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

Postby Dr_D » May 22, 2019 23:06

Sorry to be a pest, but I have another question. Is there an utility to determine if a sound is currently playing?
badidea
Posts: 1401
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 » May 23, 2019 21:30

Dr_D wrote:Sorry to be a pest, but I have another question. Is there an utility to determine if a sound is currently playing?

I made this routine (after some advice somewhere in this topic):

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

I cannot answer the question on looping sound (at the moment).
Dr_D
Posts: 2376
Joined: May 27, 2005 4:59
Contact:

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

Postby Dr_D » May 23, 2019 21:46

Ahh, hmm.... I hadn't noticed it worked with a specific pointer like that. Thanks!
badidea
Posts: 1401
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 » May 23, 2019 21:58

Some thoughts on the sound looping question...
If the last sample value of the sound does not line up with the first sample value of the sound, I would expect some 'pop'.
I was playing a bit with this in the ALSA topic: viewtopic.php?f=5&t=26821&hilit=alsa#p248912
There was another issue with the sound buffer not being filled fast enough in the beginning.
I think fbound also uses ALSA (at least on linux).

Edit, see also:
viewtopic.php?f=14&t=17740&p=187445&hilit=fbsound+loop#p187445
viewtopic.php?f=3&t=12088&p=105603&hilit=fbsound+loop#p105603
Last edited by badidea on May 23, 2019 22:16, edited 1 time in total.
Dr_D
Posts: 2376
Joined: May 27, 2005 4:59
Contact:

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

Postby Dr_D » May 23, 2019 22:15

Well, what I did was create the thrust sound, double the length, copy the first half and paste it in reverse at the midpoint. It loops seamlessly, but maybe the trick is to stop it at an endpoint?
Dr_D
Posts: 2376
Joined: May 27, 2005 4:59
Contact:

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

Postby Dr_D » May 23, 2019 22:19

I can post the sound, if you would like to experiment with it. I'll post the whole program eventually, but it isn't really a game yet... It isn't that impressive right now, and you can't even die yet. :p
badidea
Posts: 1401
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 » May 23, 2019 22:34

Dr_D wrote:I can post the sound, if you would like to experiment with it. I'll post the whole program eventually, but it isn't really a game yet... It isn't that impressive right now, and you can't even die yet. :p

I can try something, but not in the next 16 hours (sleep and work first).
I once started some code to simulate a 'revving' car to experiment with fbsound. But I got distracted by some other stuff and never continued.
Dr_D
Posts: 2376
Joined: May 27, 2005 4:59
Contact:

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

Postby Dr_D » May 23, 2019 22:36

Ok. Thanks again. Get some sleep. You've already opened doors for me. :)
Dr_D
Posts: 2376
Joined: May 27, 2005 4:59
Contact:

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

Postby Dr_D » Jun 03, 2019 22:13

Heya... I did some tests and discovered that the popping artifact has nothing to do with FBSound. As far as I can tell, there is an issue with my audio hardware. Even with professional audio recording/editing software, the buffers eventually get corrupted. Sorry for the nonsense. lol

Return to “Libraries”

Who is online

Users browsing this forum: No registered users and 2 guests