社区
多媒体/流媒体开发
帖子详情
求助~~ 麦克风和混音mixer只能选择一个。。如用同时捕捉这两路输入。
starcbh
2006-02-17 03:33:23
麦克风和混音mixer只能选择一个。。如用同时捕捉这两路输入??
~~~~~~~~~~~~~~~~~
...全文
238
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
打赏
举报
回复
这个不行吧。
ES8388官方文档
ES8388官方文档
混音
器原理及
Mixer
API函数介绍
混音
器原理及
Mixer
API函数介绍 为了理解
Mixer
API是如何工作的,首先我们得弄清楚
一个
典型声卡的硬件组成。因此非常有必要去建立
一个
声卡模型,此声卡应拥有多个典型的组件并且这些组件都是相关联的。 让我们看
一个
典型的、最基本的声卡。首先,如果声卡能够进行数字化录音,那么典型情况下它就有
一个
Microphone Input(
麦克风
传声器,下同)(附有某种前置放大器),同时它还有一
Gating自动
混音
器
在上一篇 “Gating自动
混音
器(一)“,我们已经了解了Gating自动
混音
器是干什么用的,它主要解决的问题是什么。在有多个
麦克风
的场景下,传统的做法是将多个
麦克风
混音
输出到音箱。这样的做法不可取,它可能导致的问题是,一、及其容易产生啸叫,因为2路信号
混音
,总输出增加3dB,更何况多支呢。二、即使可以通过增益比例去控制每只
麦克风
在总输出中占的比例,以达到总输出不增加的目的,也非常容易导致说话人说...
混音
器原理及
Mixer
API函数介绍1
为了理解
Mixer
API是如何工作的,首先我们得弄清楚
一个
典型声卡的硬件组成。因此非常有必要去建立
一个
声卡模型,此声卡应拥有多个典型的组件并且这些组件都是相关联的。 让我们看
一个
典型的、最基本的声卡。首先,如果声卡能够进行数字化录音,那么典型情况下它就有
一个
Microphone Input(
麦克风
传声器,下同)(附有某种前置放大器),同时它还有
一个
ADC(模数转换器,下同)将
麦克风
输入
的模
关于多路语音
混音
的思考与实现
在最近的项目开发中涉及到
一个
伴奏和类似K歌的功能,最明显的做法就是将播放器里播放的声音扑捉到缓冲区里与
麦克风
的声音做混合,然后编码发送出去。这里有个关键环节就是
混音
。因为是音乐类的声音混合,所以要求尽量保真。我看了数字信号处理方面关于波形混合的算法描述,其实就是两个波形值线性相加得到新的波形就可以了。用符号描述: Si= Bi + Pi; (i = 1 , 2, ,3 ...N, B表示背景音,
多媒体/流媒体开发
2,554
社区成员
20,277
社区内容
发帖
与我相关
我的任务
多媒体/流媒体开发
专题开发/技术/项目 多媒体/流媒体开发
复制链接
扫一扫
分享
社区描述
专题开发/技术/项目 多媒体/流媒体开发
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
暂无公告
试试用AI创作助手写篇文章吧
+ 用AI写文章