Click here to Skip to main content
16,008,719 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
Questionis there an api for... Pin
locoone3-Jan-07 17:15
locoone3-Jan-07 17:15 
AnswerRe: is there an api for... Pin
prasad_som3-Jan-07 18:31
prasad_som3-Jan-07 18:31 
GeneralRe: is there an api for... Pin
locoone6-Jan-07 15:53
locoone6-Jan-07 15:53 
AnswerRe: is there an api for... Pin
Hamid_RT4-Jan-07 5:40
Hamid_RT4-Jan-07 5:40 
QuestionCFile/CStdioFile Carriage return not being picked up Pin
devvvy3-Jan-07 14:58
devvvy3-Jan-07 14:58 
AnswerRe: Carriage return not being picked up Pin
Mark Salsbery3-Jan-07 15:04
Mark Salsbery3-Jan-07 15:04 
GeneralRe: Carriage return not being picked up Pin
devvvy3-Jan-07 15:28
devvvy3-Jan-07 15:28 
QuestionChoose the ''Stereo Min' now, how choose the 'microphone' Pin
MyNothing3-Jan-07 14:30
MyNothing3-Jan-07 14:30 
Project-->Link:winmm.lib
#include "mmsystem.h"


BOOL GetRecordradio()
{

UINT m_uMxId2;
//HWND m_hWnd;//回调句柄
HMIXER m_hmx2;
MIXERCAPS mxcaps;

//返回系统中混音器数量(如:一块普通声卡提供一个混音器设备)
int devnum=mixerGetNumDevs();
int i=0;

for(i;i<devnum;i++)
{
m_umxid2=i;
if (mmsyserr_noerror="" !="
mixerOpen(&m_hmx2," m_umxid2,null,="" 0,="" callback_window))
="" &#20351;&#29992;dwcallback&#21442;&#25968;
return="" -1;

="" &#24471;&#21040;&#30456;&#24212;&#35774;&#22791;&#26631;&#35782;&#21495;
="" mixergetid((hmixerobj)m_hmx2,&m_umxid,mixer_objectf_hmixer);

="" &#30830;&#23450;&#21508;&#28151;&#38899;&#22120;&#35774;&#22791;&#30340;&#33021;&#21147;:&#20445;&#23384;&#22312;mxcaps&#32467;&#26500;&#20013;&#65288;wmid,wpid,szname,cdestinations&#65289;
if="" false;

="" &#26816;&#32034;&#25351;&#23450;&#38899;&#39057;&#32447;&#36335;&#30340;&#20449;&#24687;,&#20445;&#23384;&#22312;mixerline&#32467;&#26500;&#20013;&#65292;
="" &#20854;&#20013;&#19968;&#20123;&#25104;&#21592;&#26681;&#25454;&#19981;&#21516;&#24773;&#20917;&#35201;&#21021;&#22987;&#21270;
mixerline="" mxl;
mxl.cbstruct="sizeof(MIXERLINE);" &#24517;&#39035;&#36171;&#20540;

="" &#21487;&#20197;&#36890;&#36807;&#22810;&#31181;&#26465;&#20214;&#26469;&#26816;&#32034;&#65306;
="" &#26041;&#24335;&#19968;&#65306;&#26681;&#25454;&#30446;&#26631;&#21333;&#20803;&#32534;&#21495;
="" mxl.dwdestination="0;等同用mxl.dwComponentType=MIXERLINE_COMPONENTTYPE_DST_SPEAKERS
//mxl.dwDestination=1;等同用mxl.dwComponentType=MIXERLINE_COMPONENTTYPE_DST_WAVEIN
//对应flag:" mixer_getlineinfof_destination
="" =="" mixerline_componenttype_dst_wavein;
="" &#23545;&#24212;flag:="" mixer_getlineinfof_componenttype

if="" (::mixergetlineinfo((hmixerobj)m_hmx2,
&mxl,
mixer_objectf_hmixer="" |
mixer_getlineinfof_componenttype)
!="MMSYSERR_NOERROR)" return="" &#26597;&#35810;="" &#24405;&#38899;&#25511;&#21046;&#38754;&#29256;&#20013;="" &#40614;&#20811;&#39118;&#32447;&#36335;&#30340;&#32534;&#21495;=""
mixerline="" mxl_v;
uint="" cconnections="(UINT)mxl.cConnections;
UINT" dwsource_v="0;
do
{
mxl_v.cbStruct" sizeof(mxl_v);
mxl_v.dwdestination="mxl.dwDestination;
mxl_v.dwSource" dwsource_v;
dwsource_v++;
if=""
&mxl_v,=""
mixer_getlineinfof_source))
return="" false;
}="" while="" ((dwsource_v="" <="" cconnections)="" &&=""
(mxl_v.dwcomponenttype=""> cConnections) ||
(mxl_v.dwComponentType !=MIXERLINE_COMPONENTTYPE_SRC_MICROPHONE))
return FALSE;
dwSource_v--;//得到编号

//下面这段文字说明在本例中已经没有什么实际意义,是以前调试时留下的,也不删除了,
//可以知道如何控制主音(Volume)线路的禁音状态:
//--可以利用得到的主音(Volume)线路的mxl.dwLineID,
//来查询Volume的禁音状态
//要想查询(或设置)可以混音到DST_SPEAKERS主音(Volume)中的
//相关音源线路(如:wave、micphone等)的禁音状态,还必须再使用
//一次 mixerGetLineInfo 进一步指定其dwLineID
//注意:不要简单的直接修改上面的:
//mxl.dwComponentType = 类型;
//虽然可能有时不会报错,但这成了我们程序中的隐患,
//因为有的线路在DST_SPEAKERS和DST_WAVEIN中均有,如:
//MIXERLINE_COMPONENTTYPE_SRC_COMPACTDISC


//下面实现了"强制"单选麦克风线路为录音源输入
MIXERCONTROL mxc;
MIXERLINECONTROLS mxlc;
mxlc.cbStruct = sizeof(MIXERLINECONTROLS);
mxlc.dwLineID = mxl.dwLineID;
mxlc.dwControlType = MIXERCONTROL_CONTROLTYPE_MUX;
//MIXERCONTROL_CONTROLTYPE_MUTE;
mxlc.cControls = 1;
mxlc.cbmxctrl = sizeof(MIXERCONTROL);
mxlc.pamxctrl = &mxc; //为了得到相应的mxc.dwControlID,
//锁定mxlc.dwLineID和mxlc.dwControlType指定的线路控制
//目前将对录音目标单元的录音音源线路做单选(多路复用)
if (::mixerGetLineControls((HMIXEROBJ)m_hmx2,
&mxlc,
MIXER_OBJECTF_HMIXER |
MIXER_GETLINECONTROLSF_ONEBYTYPE)
!= MMSYSERR_NOERROR) return -1;

//根据mxc.dwControlID检索线路,
MIXERCONTROLDETAILS_BOOLEAN mxcdMute[8];
MIXERCONTROLDETAILS mxcd;
mxcd.cbStruct = sizeof(MIXERCONTROLDETAILS);
mxcd.dwControlID = mxc.dwControlID;//在上面的&mxc得到
mxcd.cChannels = 1;
mxcd.cMultipleItems =mxc.cMultipleItems;//多路因子数目
mxcd.cbDetails = sizeof(*mxcdMute);
mxcd.paDetails =&mxcdMute;//存放检索结果
if (::mixerGetControlDetails((HMIXEROBJ)m_hmx2,
&mxcd,
MIXER_OBJECTF_HMIXER |
MIXER_GETCONTROLDETAILSF_VALUE)
!= MMSYSERR_NOERROR) return -1;

//做相应单选改变
int j;
for(j=0;j<(int)mxc.cMultipleItems;j++)
mxcdMute[j].fValue=false;
mxcdMute[dwSource_v].fValue=true;

//重新设置dwControlID锁定的线路控制
if (::mixerSetControlDetails((HMIXEROBJ)m_hmx2,
&mxcd,
MIXER_OBJECTF_HMIXER |
MIXER_GETCONTROLDETAILSF_VALUE)
!= MMSYSERR_NOERROR) return -1;
}//for(i;i
QuestionNeed to convert COLORREF to COLOR16 Pin
CoffeeAddict193-Jan-07 13:58
CoffeeAddict193-Jan-07 13:58 
AnswerRe: Need to convert COLORREF to COLOR16 Pin
Michael Dunn3-Jan-07 14:22
sitebuilderMichael Dunn3-Jan-07 14:22 
GeneralRe: Need to convert COLORREF to COLOR16 Pin
CoffeeAddict193-Jan-07 14:45
CoffeeAddict193-Jan-07 14:45 
GeneralRe: Need to convert COLORREF to COLOR16 Pin
Michael Dunn3-Jan-07 14:48
sitebuilderMichael Dunn3-Jan-07 14:48 
GeneralRe: Need to convert COLORREF to COLOR16 Pin
CoffeeAddict193-Jan-07 14:51
CoffeeAddict193-Jan-07 14:51 
AnswerRe: Need to convert COLORREF to COLOR16 Pin
Mark Salsbery3-Jan-07 15:00
Mark Salsbery3-Jan-07 15:00 
QuestionProblem with EndDialog Pin
Fernando A. Gomez F.3-Jan-07 13:18
Fernando A. Gomez F.3-Jan-07 13:18 
AnswerRe: Problem with EndDialog Pin
Mark Salsbery3-Jan-07 13:28
Mark Salsbery3-Jan-07 13:28 
QuestionRe: Problem with EndDialog Pin
Fernando A. Gomez F.3-Jan-07 13:31
Fernando A. Gomez F.3-Jan-07 13:31 
AnswerRe: Problem with EndDialog Pin
Mark Salsbery3-Jan-07 13:40
Mark Salsbery3-Jan-07 13:40 
GeneralRe: Problem with EndDialog Pin
Fernando A. Gomez F.3-Jan-07 13:55
Fernando A. Gomez F.3-Jan-07 13:55 
GeneralRe: Problem with EndDialog Pin
Mark Salsbery3-Jan-07 14:47
Mark Salsbery3-Jan-07 14:47 
GeneralRe: Problem with EndDialog Pin
Fernando A. Gomez F.4-Jan-07 8:07
Fernando A. Gomez F.4-Jan-07 8:07 
AnswerRe: Problem with EndDialog Pin
Michael Dunn3-Jan-07 14:24
sitebuilderMichael Dunn3-Jan-07 14:24 
GeneralRe: Problem with EndDialog Pin
Fernando A. Gomez F.3-Jan-07 14:27
Fernando A. Gomez F.3-Jan-07 14:27 
GeneralRe: Problem with EndDialog Pin
Fernando A. Gomez F.4-Jan-07 8:08
Fernando A. Gomez F.4-Jan-07 8:08 
AnswerRe: Problem with EndDialog Pin
Rajesh R Subramanian3-Jan-07 19:58
professionalRajesh R Subramanian3-Jan-07 19:58 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.