用C嵌入声音可执行++ [英] embedding sound in executable in C++

查看:141
本文介绍了用C嵌入声音可执行++的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我怎么可以存储声音我的可执行文件?让我们pretend我有函数x播放声音位于C:\\声音,我怎么能存储可执行的内部sound.wav?我必须读它以字节和硬code将其字节某些变量,然后创建文件,当用户执行我的文件,玩什么呢?

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?

推荐答案

我会建议硬编码的.wav的内容在某些变量,然后发挥它的使用'sndPlaySound与SND_MEMORY'选项内容由提供的这个例子微软:
http://support.microsoft.com/kb/133064

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

这篇关于用C嵌入声音可执行++的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆