C++: 播放同一文件夹中的.Wav 文件吗?

发布于 2024-12-17 07:06:32 字数 1434 浏览 3 评论 0原文

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

谁与争疯 2024-12-24 07:06:32

PlaySound 函数(mmsystem.h)实际上是在 win 控制台应用程序中播放 wav 文件的最简单方法。 Libsndfile 库可能是可用的最强大的免费音频文件库(支持数十种音频文件格式,包括 ogg 和 flac),但是您读取原始音频数据 - 样本,因此为了能够播放它们,您必须将它们发送到音频装置,没那么简单……

PlaySound function (mmsystem.h) is really the simplest way how to play a wav file in a win console application. Libsndfile library is probably the most powerful free audio file library available (support for tens of audio file formats including ogg and flac), but you read raw audio data - samples, so to be able to play them, you must send them to the audio device, which is not so simple...

无言温柔 2024-12-24 07:06:32

您应该能够使用 windows.h,有一个函数的工作原理如下:

PlaySound("C:\\SOUNDS\\BELLS.WAV", NULL, SND_ASYNC);

You should be able to use windows.h, there's a function that works like this:

PlaySound("C:\\SOUNDS\\BELLS.WAV", NULL, SND_ASYNC);
私藏温柔 2024-12-24 07:06:32

如果我没记错的话,人们说过 libsndfile 是处理 WAV 文件的简单方法。

If I recall correctly, people have said that libsndfile is a simple way to handle WAV files.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文