Jokeoo 最近的时间轴更新
Jokeoo

Jokeoo

V2EX 第 559198 号会员,加入于 2021-10-21 09:47:59 +08:00
Jokeoo 最近回复了
在 Linux ( Ubuntu )下,可以使用 PulseAudio 库来捕获系统声音。以下是一个简单的示例代码片段,可以通过 g++编译:

```
#include <pulse/simple.h>
#include <pulse/error.h>
#include <cstdio>
#include <cstring>
#include <iostream>
using namespace std;

#define BUFSIZE 1024

int main(int argc, char const *argv[]) {
pa_sample_spec ss;
ss.format = PA_SAMPLE_S16LE;
ss.channels = 2;
ss.rate = 44100;
int error;
pa_simple *s = pa_simple_new(NULL, argv[0], PA_STREAM_RECORD, NULL, "record", &ss, NULL, NULL, &error);
if (!s) {
cerr << "pa_simple_new() failed: " << pa_strerror(error) << endl;
return 1;
}

char buf[BUFSIZE];
int cnt = 0;
while (cnt++ < 100) {
int ret = pa_simple_read(s, buf, BUFSIZE, &error);
if (ret < 0) {
cerr << "pa_simple_read() failed: " << pa_strerror(error) << endl;
break;
}
fwrite(buf, 1, ret, stdout);
}

pa_simple_free(s);
return 0;
}

```

该代码将捕获系统声音,并将其输出到标准输出( stdout )。您可以将其修改为将音频写入文件或进行其他处理。

notion AI
2022-07-20 09:31:42 +08:00
回复了 andyJado 创建的主题 程序员 你最常用的 CLI(命令行工具)是什么?
1 1825 18.2027% tig
2 1224 12.2083% git
3 924 9.21604% l
4 601 5.99441% cd
5 567 5.6553% picocom
6 560 5.58548% vi
7 418 4.16916% repo
8 374 3.7303% bflb-iot-tool
9 363 3.62059% sudo
10 273 2.72292% gfa
2022-06-29 10:19:16 +08:00
回复了 zmx976508106 创建的主题 上海 上海徐汇区漕河泾附近求租房
最近上海租房价格大涨真的假的
2022-01-17 11:09:40 +08:00
回复了 MajestySolor 创建的主题 Windows 从 win11 重装回 win10,整个人都获得了新生
要不是 wslg 需要 win11 ,谁愿意升上来
2021-10-25 11:05:23 +08:00
回复了 jatsz2020 创建的主题 深圳 请问哪些地方租房可以开 invoice 报销?
receipt [riˈsiːt]

释义

n.收据,收条;接受;收到;(pl.)收入款;领到;食谱

vt.开收据;签帐单

vi.开收据
关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   5729 人在线   最高记录 6543   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 20ms · UTC 01:50 · PVG 09:50 · LAX 18:50 · JFK 21:50
Developed with CodeLauncher
♥ Do have faith in what you're doing.