dw2693734d 最近的时间轴更新
dw2693734d

dw2693734d

V2EX 第 601784 号会员,加入于 2022-11-14 22:49:28 +08:00
今日活跃度排名 9460
dw2693734d 最近回复了
17 小时 43 分钟前
回复了 dw2693734d 创建的主题 MacBook Pro M1 MacBook 隔几天就重启一次,什么情况
@oIMOo 不是的,就是直接死机,然后不得不重启
1 天前
回复了 IslandOwnerHuang 创建的主题 MacBook Pro 想换 ARM 芯片的 MBP 16 了,求打醒
买,我现在就用的 m1 16 寸,香的很
5 天前
回复了 xtR0d666 创建的主题 MacBook Pro 朋友二手 mbp 1w4 卖我价格合适不?
价格不错
6 天前
回复了 BlackAdlerChi 创建的主题 浏览器 Safari on Mac 的实用性讨论
Safari 不支持 Metamask ,没法用
小红点好用吗,感觉用久了手指不舒服
react 自带的 use 系列不香吗
13 天前
回复了 foolishcrab 创建的主题 程序员 React 新文档骂战引发的的思考
nextjs 香的一匹
14 天前
回复了 chackchackGO 创建的主题 问与答 gpt4 之后会开放给普通用户吗?
用 depay 买
#include <iostream>
#include <pulse/simple.h>
#include <pulse/error.h>
#include <fstream>

int main() {
const char* fileName = "output.raw";
std::ofstream outFile(fileName, std::ios::binary);

pa_sample_spec sampleSpec;
sampleSpec.format = PA_SAMPLE_S16LE;
sampleSpec.rate = 44100;
sampleSpec.channels = 2;

pa_simple *pulseAudioSimple = nullptr;
int error;

pulseAudioSimple = pa_simple_new(NULL, "record_system_audio", PA_STREAM_RECORD, NULL, "record", &sampleSpec, NULL, NULL, &error);
if (!pulseAudioSimple) {
std::cerr << "Error: Could not create PulseAudio simple:" << pa_strerror(error) << std::endl;
return 1;
}

const size_t numSamples = 44100 * 10; // Record for 10 seconds
int16_t buffer[numSamples];

if (pa_simple_read(pulseAudioSimple, buffer, sizeof(buffer), &error) < 0) {
std::cerr << "Error: Could not read from PulseAudio: " << pa_strerror(error) << std::endl;
pa_simple_free(pulseAudioSimple);
return 1;
}

outFile.write(reinterpret_cast<char*>(buffer), sizeof(buffer));

pa_simple_free(pulseAudioSimple);
outFile.close();

std::cout << "System audio has been recorded successfully. Output saved to " << fileName << std::endl;
return 0;
}
关于   ·   帮助文档   ·   博客   ·   nftychat   ·   API   ·   FAQ   ·   我们的愿景   ·   广告投放   ·   实用小工具   ·   2443 人在线   最高记录 5556   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 32ms · UTC 08:24 · PVG 16:24 · LAX 01:24 · JFK 04:24
Developed with CodeLauncher
♥ Do have faith in what you're doing.