播放声音在C ++中使用本机的系统调用? [英] Playing sound in C++ using native system calls?

查看:182
本文介绍了播放声音在C ++中使用本机的系统调用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

因此​​,在Windows中,可以使用 PlaySound 函数的C ++应用程序播放MP3文件。什么是在Mac OS X / Linux的可使用一些类似的功能呢?我也AP preciate它,如果你可以链接到一些示例你好,世界类型的程序证明这一点。

So in Windows, you can use the PlaySound function to play an MP3 file in a C++ application. What would be some similar functions available for use in Mac OS X/Linux? I would also appreciate it if you could link to some sample Hello-World type programs demonstrating this.

推荐答案

您可以只打开(的/ dev / DSP)和写入。这是因为原生系统调用,你可以得到,我相信。

You can just open("/dev/dsp") and write to it. That's as "native syscall" as you can get, I believe.

这篇关于播放声音在C ++中使用本机的系统调用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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