社区
多媒体/流媒体开发
帖子详情
求助~~ 麦克风和混音mixer只能选择一个。。如用同时捕捉这两路输入。
starcbh
2006-02-17 03:33:23
麦克风和混音mixer只能选择一个。。如用同时捕捉这两路输入??
~~~~~~~~~~~~~~~~~
...全文
217
7
打赏
收藏
求助~~ 麦克风和混音mixer只能选择一个。。如用同时捕捉这两路输入。
麦克风和混音mixer只能选择一个。。如用同时捕捉这两路输入?? ~~~~~~~~~~~~~~~~~
复制链接
扫一扫
分享
转发到动态
举报
写回复
配置赞助广告
用AI写文章
7 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
lserlohn
2006-03-22
打赏
举报
回复
应该可以吧,我觉得只要你能够采集到这两路音频,写一个Transform Filter,两个输入Pin一个输出Pin,中间过程的处理,我倒是有个一例子
mix(sample_buffer_t &samples)
{
sample_t buf[NCHANNELS];
int ch, nsample;
int in_ch = in_mode.channels;
int out_ch = out_mode.channels;
int in_nch = in_mode.nchans();
int out_nch = out_mode.nchans();
int in_order[6];
int out_order[6];
memcpy(in_order, in_mode.order, sizeof(in_order));
memcpy(out_order, out_mode.order, sizeof(out_order));
sample_t max;
sample_t factor;
sample_t s;
sample_t *sptr;
sample_t in_levels_loc[NCHANNELS];
sample_t out_levels_loc[NCHANNELS];
memset(in_levels_loc, 0, sizeof(in_levels_loc));
memset(out_levels_loc, 0, sizeof(out_levels_loc));
sample_t release_factor;
if (release < 1.0)
release = 1.0;
release_factor = pow(release, double(NSAMPLES) / 48000);
///////////////////////////////////////
// Reorder matrix
mixer_matrix_t m;
memset(&m, 0, sizeof(m));
int ch1, ch2;
for (ch1 = 0; ch1 < in_nch; ch1++)
for (ch2 = 0; ch2 < out_nch; ch2++)
m[ch1][ch2] = matrix[in_order[ch1]][out_order[ch2]] * in_gains[in_order[ch1]] * out_gains[out_order[ch2]];
///////////////////////////////////////
// Adjust gain
///////////////////////////////////////
// Adjust gain
if (auto_gain && !normalize)
if (gain * release_factor > master)
gain = master;
else
gain *= release_factor;
///////////////////////////////////////
// Input levels
// optimize: expand channels cycle
for (ch = 0; ch < in_nch; ch++)
{
max = 0;
sptr = samples[ch];
for (nsample = 0; nsample < NSAMPLES2/8; nsample++)
{
if (fabs(*sptr) > max) max = fabs(*sptr); sptr++;
if (fabs(*sptr) > max) max = fabs(*sptr); sptr++;
if (fabs(*sptr) > max) max = fabs(*sptr); sptr++;
if (fabs(*sptr) > max) max = fabs(*sptr); sptr++;
if (fabs(*sptr) > max) max = fabs(*sptr); sptr++;
if (fabs(*sptr) > max) max = fabs(*sptr); sptr++;
if (fabs(*sptr) > max) max = fabs(*sptr); sptr++;
if (fabs(*sptr) > max) max = fabs(*sptr); sptr++;
}
in_levels_loc[ch] = max;
}
max = in_levels_loc[0];
for (ch = 1; ch < in_nch; ch++)
if (max < in_levels_loc[ch]) max = in_levels_loc[ch];
///////////////////////////////////////
// DRC
// drc_power means level increase at -50dB
if (drc_on)
if (drc_level * release_factor > pow(max/in_mode.level, -log10(drc_power)*20/50))
drc_level = pow(max/in_mode.level, -log10(drc_power)*20/50);
else
drc_level *= release_factor;
else
drc_level = 1.0;
///////////////////////////////////////
// Mix samples
// optimize: do not multiply by nulls (most of matrix)
factor = gain * drc_level * out_mode.level / in_mode.level;
memset(buf, 0, sizeof(buf));
for (nsample = 0; nsample < NSAMPLES2; nsample++)
{
for (ch = 0; ch < out_nch; ch++)
{
buf[ch] = 0;
for (ch2 = 0; ch2 < in_nch; ch2++)
buf[ch] += samples[ch2][nsample] * m[ch2][ch];
}
for (ch = 0; ch < out_nch; ch++)
samples[ch][nsample] = buf[ch] * factor;
}
///////////////////////////////////////
// Output levels
memset(out_levels_loc, 0, sizeof(out_levels_loc));
for (ch = 0; ch < out_nch; ch++)
{
max = 0;
sptr = samples[ch];
for (nsample = 0; nsample < NSAMPLES2/8; nsample++)
{
if (fabs(*sptr) > max) max = fabs(*sptr); sptr++;
if (fabs(*sptr) > max) max = fabs(*sptr); sptr++;
if (fabs(*sptr) > max) max = fabs(*sptr); sptr++;
if (fabs(*sptr) > max) max = fabs(*sptr); sptr++;
if (fabs(*sptr) > max) max = fabs(*sptr); sptr++;
if (fabs(*sptr) > max) max = fabs(*sptr); sptr++;
if (fabs(*sptr) > max) max = fabs(*sptr); sptr++;
if (fabs(*sptr) > max) max = fabs(*sptr); sptr++;
}
out_levels_loc[ch] = max;
}
max = out_levels_loc[0];
for (ch = 1; ch < out_nch; ch++)
if (max < out_levels_loc[ch]) max = out_levels_loc[ch];
///////////////////////////////////////
// Auto Gain Control
if (auto_gain)
{
if (max > out_mode.level)
{
factor = out_mode.level / max;
gain *= factor;
if (gain < min_gain)
{
factor *= min_gain / gain;
gain = min_gain;
}
max *= factor;
sptr = (float *)samples;
nsample = out_nch * NSAMPLES2 / 8;
while (nsample--)
{
*sptr++ *= factor; *sptr++ *= factor;
*sptr++ *= factor; *sptr++ *= factor;
*sptr++ *= factor; *sptr++ *= factor;
*sptr++ *= factor; *sptr++ *= factor;
}
}
}
///////////////////////////////////////
// Clip
// should be rare
if (max > out_mode.level)
{
sptr = (sample_t *)samples;
nsample = out_nch * NSAMPLES2;
while (nsample--)
{
s = *sptr;
if (s > +out_mode.level) *sptr = +out_mode.level;
if (s < -out_mode.level) *sptr = -out_mode.level;
sptr++;
}
}
///////////////////////////////////////
// Normalize output levels
for (ch = 0; ch < NCHANNELS; ch++)
{
if (CH_MASK(in_order[ch]) & in_ch)
{
in_levels_loc[ch] /= in_mode.level;
in_levels_loc[ch] *= in_gains[in_order[ch]];
if (in_levels_loc[ch] > in_levels[in_order[ch]])
in_levels[in_order[ch]] = in_levels_loc[ch];
}
if (CH_MASK(out_order[ch]) & out_ch)
{
out_levels_loc[ch] /= out_mode.level;
if (out_levels_loc[ch] > out_levels[out_order[ch]])
out_levels[out_order[ch]] = out_levels_loc[ch];
}
}
具体的你到Sourceforge.net上搜索一个叫matrix mixer的例子看看好了,我是搞视频混合的,对这个也不是太了解。
zcd_jimy
2006-03-22
打赏
举报
回复
个人认为是不行的, 在windows中, 录音选择音源时, 都是只能选其中一个.
如果非要这样, 那肯定要声卡支持同时采集两路音源.
cx0928
2006-02-22
打赏
举报
回复
可以考虑使用硬件混响器
ccxian123
2006-02-21
打赏
举报
回复
采集两个出来,再混合应该可以的。
zhaojian999
2006-02-21
打赏
举报
回复
我觉得也不行
蒋晟
2006-02-21
打赏
举报
回复
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/directx9_c/enumerating_capture_devices.asp
DentistryDoctor
2006-02-18
打赏
举报
回复
这个不行吧。
alsa
mixer
编程
在声卡的硬件电
路
中,
混音
器(
mixer
)是一个很重要的组成部分,它的作用是将多个信号组合或者叠加在一起,对于不同的声卡来说,其
混音
器的作用可能各不相同。运行在Linux内核中的声卡驱动程序一般都会提供/dev/
mixer
...
混音
器原理及
Mixer
API函数介绍
混音
器原理及
Mixer
API函数介绍 为了理解
Mixer
API是如何工作的,首先...首先,如果声卡能够进行数字化录音,那么典型情况下它就有一个Microphone Input(
麦克风
传声器,下同)(附有某种前置放大器),同时它还有一
WebRTC中
混音
流程分析
混音
分为服务端
混音
和客户端
混音
两种,服务端
混音
是为了节省带宽。哪为什么客户端也要
混音
呢?哪是国为声卡同一时刻
只能
播放一
路
语音,当你的客户端有多
路
接收语音时,如果你不先
混音
,而是每一
路
都直接住声卡送的...
混音
器原理及
Mixer
API函数介绍1
为了理解
Mixer
API是如何工作的,首先我们得弄清楚一个典型声卡的硬件组成。因此非常有必要去建立一个... Input(
麦克风
传声器,下同)(附有某种前置放大器),同时它还有一个ADC(模数转换器,下同)将
麦克风
输入
的模
ffmpeg 本地
麦克风
声音和系统声音
混音
后,再混合本地桌面成最终的mp4文件
之前写过ffmpeg录制
麦克风
声音和pc内部声音(如播放歌曲)—
混音
,现在再进一步,
混音
后,再和采集到的桌面视频合在一处。 现在说说大致思
路
,如下所示,创建了四个线程 HANDLE hThreadAudio = CreateThread(NULL, 0,...
多媒体/流媒体开发
2,543
社区成员
20,281
社区内容
发帖
与我相关
我的任务
多媒体/流媒体开发
专题开发/技术/项目 多媒体/流媒体开发
复制链接
扫一扫
分享
社区描述
专题开发/技术/项目 多媒体/流媒体开发
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
暂无公告
试试用AI创作助手写篇文章吧
+ 用AI写文章