Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Building sounds with _SNDPLAYCOPY?
#5
(10-12-2022, 09:54 PM)a740g Wrote:
(10-12-2022, 09:04 PM)james2464 Wrote: If you were making a game and wanted to repeat this overall routine, would you just repeat the routine or try to capture it into a sound file and just use that?   Hope I'm making sense.  Just curious what a good strategy would be.

I think I get what you are saying. Well, there are multiple ways to do this.

You can do it with static sounds and then programmatically change the sound parameters on-the-fly like you are doing in the example. This obviously is not too flexible and does not allow you to do advanced effects. You'll be limited to position, volume, and panning effects.

You could also programmatically generate the sound waveform yourself and play it using SNDRAW. This allows you to do very advanced audio effects. However, it requires you to "run" your sound generating code that is pushing the samples to SNDRAW whenever you want to play the sound. This may be processor intensive (especially on low spec. hardware).

A third way would be to generate the waveform once and store it in a buffer and then play the buffer whenever needed. QB64-PE does not have this functionality yet. However, it is planned. See We need some kind of _NEWSND function to make sound buffers · Issue #28 · QB64-Phoenix-Edition/QB64pe (github.com)

Thanks! 

That _NEWSND feature would be absolutely incredible.   No pressure!  [Image: biggrin.png]
Reply


Messages In This Thread
Building sounds with _SNDPLAYCOPY? - by james2464 - 10-12-2022, 09:04 PM
RE: Building sounds with _SNDPLAYCOPY? - by Pete - 10-12-2022, 09:29 PM
RE: Building sounds with _SNDPLAYCOPY? - by a740g - 10-13-2022, 03:06 PM
RE: Building sounds with _SNDPLAYCOPY? - by a740g - 10-12-2022, 09:54 PM
RE: Building sounds with _SNDPLAYCOPY? - by james2464 - 10-12-2022, 10:39 PM
RE: Building sounds with _SNDPLAYCOPY? - by Pete - 10-12-2022, 10:08 PM
RE: Building sounds with _SNDPLAYCOPY? - by a740g - 10-13-2022, 03:09 PM
RE: Building sounds with _SNDPLAYCOPY? - by Pete - 10-13-2022, 03:41 PM
RE: Building sounds with _SNDPLAYCOPY? - by Pete - 10-13-2022, 03:50 PM
RE: Building sounds with _SNDPLAYCOPY? - by Pete - 10-13-2022, 05:56 PM
RE: Building sounds with _SNDPLAYCOPY? - by Pete - 10-14-2022, 07:51 PM



Users browsing this thread: 4 Guest(s)