流数据声卡在Windows上用C [英] Streaming Data to Sound Card Using C on Windows

查看:222
本文介绍了流数据声卡在Windows上用C的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

作为一所大学的项目,我必须做一些信号处理和想输出使用PC声卡的结果的一部分。该软件已在C编写,并需要与Windows(preferably 7和XP)。

As part of a university project I have to do some signal processing and would like to output the results using the PC sound card. The software has to be written in C and needs to work with Windows (preferably 7 and XP).

我发现code例子输出.WAV和类似的文件,但我感兴趣的是连续输出数据,而不是从文件输出。它是可能的输出数据将psented作为数组$ P $虽然有些声音API似乎有自己的处理缓冲区的方式。

I have found code examples for outputting .wav and similar files, but I am interested in continuously outputting data rather than outputting from files. It is likely that the data for output will be presented as an array although some sound APIs seem to have their own ways of dealing with buffers.

任何建议将是巨大的,因为将code范例否则再好的API。我已经看过了DirectSound和OpenAL的,但我仍然不确定如何开始。

Any suggestions would be great, as would code examples or even the best API. I have looked at DirectSound and OpenAL but am still unsure how to get started.

推荐答案

PortAudio 是一个C库应该满足您的需求。有一个教程让你开始。

PortAudio is a C library that should suit your needs. There is a tutorial to get you started.

PortAudio是一个免费,跨平台,
  开源,音频I / O库。它
  让你写简单的音频节目
  在C语言或C ++的编译和
  在许多平台上运行,包括
  于Windows,Macintosh OS X和Unix
  (OSS / ALSA)。它的目的是促进
  之间的音频软件交流
  开发商在不同的平台。
  许多应用程序使用PortAudio为
  音频I / O。

PortAudio is a free, cross-platform, open-source, audio I/O library. It lets you write simple audio programs in 'C' or C++ that will compile and run on many platforms including Windows, Macintosh OS X, and Unix (OSS/ALSA). It is intended to promote the exchange of audio software between developers on different platforms. Many applications use PortAudio for Audio I/O.

PortAudio提供了一个非常简单的API
  用于记录和/或播放声音
  使用简单的回调函数或
  阻断读/写接口。例
  程序包括那部戏正弦
  海浪,处理音频输入(吉他
  绒毛),录制和播放音频,列表
  可用的音频设备,等等。

PortAudio provides a very simple API for recording and/or playing sound using a simple callback function or a blocking read/write interface. Example programs are included that play sine waves, process audio input (guitar fuzz), record and playback audio, list available audio devices, etc.

这篇关于流数据声卡在Windows上用C的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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