Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

embedding sound in executable in C++

Tags:

c++

audio

wav

how can I store sound in my executable file? Let's pretend I have function x to play sound located in C:\sounds, how can I store sound.wav inside of executable? do I have to read it byte by byte and hardcode it in some variable, then create file and play it when user executes my file?

like image 497
encoree1337 Avatar asked Jul 13 '26 04:07

encoree1337


1 Answers

I would advice hardcoding the contents of the .wav in some variable and then play it's contents using 'sndPlaySound' with 'SND_MEMORY' option as in this example supplied by Microsoft: http://support.microsoft.com/kb/133064

like image 134
Steen Avatar answered Jul 14 '26 18:07

Steen



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!