0

I have an array of a .wav file like this:

const char down[27624] = { ... }

And I would like to play it as a sound. I understand how to play a file that already exists on the filesystem:

PlaySound(TEXT("sound.wav"), NULL, SND_FILENAME | SND_ASYNC);

but how would I go about playing an array?

EDIT: Don't bother, and write it to a temp file.

H4ZE
  • 183
  • 1
  • 1
  • 9
  • What audio library are you using? It's certainly not SDL, but here's how to do it in that if you're open to switching libraries: https://stackoverflow.com/questions/10110905/simple-sound-wave-generator-with-sdl-in-c – Guy Keogh Jun 17 '20 at 16:31
  • @GuyKeogh SDL seems too complicated for me – H4ZE Jun 17 '20 at 16:43
  • What audio library are you using? – Galik Jun 17 '20 at 16:47
  • @Galik I don't understand your question, maybe Windows.h? – H4ZE Jun 17 '20 at 16:49
  • I'd bite the bullet and use a framework. It is going to be less complicated than learning to directly wrangle Window's Audio APIs. The framework will have done most of the grunt work and set most of the fiddly bits for you. – user4581301 Jun 17 '20 at 17:04
  • Here is a similar thread, I suggest you could refer to :https://stackoverflow.com/questions/45555943/c-playing-audio-live-from-byte-array – Jeaninez - MSFT Jun 18 '20 at 02:56

0 Answers0