myGully.com

myGully.com (https://mygully.com/index.php)
-   Programmierung (https://mygully.com/forumdisplay.php?f=67)
-   -   Mute-Knopf fürs Mikrofon (https://mygully.com/showthread.php?t=1873345)

Mr. Bobby 18.05.09 22:10

Mute-Knopf fürs Mikrofon
 
Hallöchen.

ich suche eine möglichkeit mein mikrofon vom headset softwaretechnisch aus und einzuschalten.
am besten ein knopf/ batch/ docklet, der mir gleichzeitig den status anzeigt.
Ist sowas möglich? Kann mir jemand sowas machen?

Hab keinen Schalter am headset und das kabel is gut verlegt.

danke

Veni_Vidi_Vici 19.05.09 04:41

Suchst du ein Programm oder willst du eines programmieren?

[Link nur für registrierte und freigeschaltete Mitglieder sichtbar. Jetzt registrieren...]

Hier die exe dazu
[Link nur für registrierte und freigeschaltete Mitglieder sichtbar. Jetzt registrieren...]

Mr. Bobby 19.05.09 17:18

hmm, erstma danke, aber so wie ich das seh, kann das prog nur die komplette soundkarte ein/ ausschalten.

was ich aber bräuchte wäre ein einfacher weg (also shortcut aufm desktop) um mein mikrofon abzustellen. also das gleiche wie wenn ich in der lautstärkeregelung das mikrofon stumm schalte.
kann auch ein programm sein, dann würd ichs auf ne taste meiner tastatur legen.
ich will halt nur nich jedesmal in der systemsteuerung rumklicken.

btw. ich hab vista 64 rennen

kiffschwein 20.05.09 20:01

Code:

void UnMute() 
 

 
// Open the mixer device 
 
HMIXER hmx; 
 
mixerOpen(&hmx, 0, 0, 0, 0); 
 
// Get the line info for the wave in destination line 
 
MIXERLINE mxl; 
 
mxl.cbStruct = sizeof(mxl); 
 
mxl.dwComponentType = MIXERLINE_COMPONENTTYPE_DST_WAVEIN; 
 
mixerGetLineInfo((HMIXEROBJ)hmx, &mxl, MIXER_GETLINEINFOF_COMPONENTTYPE); 
 
// Now find the microphone source line connected to this wave in 
 
// destination 
 
DWORD cConnections = mxl.cConnections; 
 
for(DWORD j=0; j<cConnections; j++){ 
 
mxl.dwSource = j; 
 
mixerGetLineInfo((HMIXEROBJ)hmx, &mxl, MIXER_GETLINEINFOF_SOURCE); 
 
if (MIXERLINE_COMPONENTTYPE_SRC_MICROPHONE == mxl.dwComponentType) 
 
break; 
 

 
// Find a mute control, if any, of the microphone line 
 
LPMIXERCONTROL pmxctrl = (LPMIXERCONTROL)malloc(sizeof MIXERCONTROL); 
 
MIXERLINECONTROLS mxlctrl = {sizeof mxlctrl, mxl.dwLineID, 
 
MIXERCONTROL_CONTROLTYPE_MUTE, 1, sizeof MIXERCONTROL, pmxctrl}; 
 
if(!mixerGetLineControls((HMIXEROBJ) hmx, &mxlctrl, 
 
MIXER_GETLINECONTROLSF_ONEBYTYPE)){ 
 
// Found, so proceed 
 
DWORD cChannels = mxl.cChannels; 
 
if (MIXERCONTROL_CONTROLF_UNIFORM & pmxctrl->fdwControl) 
 
cChannels = 1; 
 
LPMIXERCONTROLDETAILS_BOOLEAN pbool = 
 
(LPMIXERCONTROLDETAILS_BOOLEAN) malloc(cChannels * sizeof 
 
MIXERCONTROLDETAILS_BOOLEAN); 
 
MIXERCONTROLDETAILS mxcd = {sizeof(mxcd), pmxctrl->dwControlID, 
 
cChannels, (HWND)0, 
 
sizeof MIXERCONTROLDETAILS_BOOLEAN, (LPVOID) pbool}; 
 
mixerGetControlDetails((HMIXEROBJ)hmx, &mxcd, 
 
MIXER_SETCONTROLDETAILSF_VALUE); 
 
// Unmute the microphone line (for both channels) 
 
pbool[0].fValue = pbool[cChannels - 1].fValue = 0; 
 
mixerSetControlDetails((HMIXEROBJ)hmx, &mxcd, 
 
MIXER_SETCONTROLDETAILSF_VALUE); 
 
free(pmxctrl); 
 
free(pbool); 
 

 
else 
 
free(pmxctrl); 
 
mixerClose(hmx); 
 

 
void SetVolume() 
 

 
// Open the mixer device 
 
HMIXER hmx; 
 
mixerOpen(&hmx, 0, 0, 0, 0); 
 
// Get the line info for the wave in destination line 
 
MIXERLINE mxl; 
 
mxl.cbStruct = sizeof(mxl); 
 
mxl.dwComponentType = MIXERLINE_COMPONENTTYPE_DST_WAVEIN; 
 
mixerGetLineInfo((HMIXEROBJ)hmx, &mxl, 
 
MIXER_GETLINEINFOF_COMPONENTTYPE); 
 
// Now find the microphone source line connected to this wave in 
 
// destination 
 
DWORD cConnections = mxl.cConnections; 
 
for(DWORD j=0; j<cConnections; j++){ 
 
mxl.dwSource = j; 
 
mixerGetLineInfo((HMIXEROBJ)hmx, &mxl, MIXER_GETLINEINFOF_SOURCE); 
 
if (MIXERLINE_COMPONENTTYPE_SRC_MICROPHONE == mxl.dwComponentType) 
 
break; 
 

 
// Find a volume control, if any, of the microphone line 
 
LPMIXERCONTROL pmxctrl = (LPMIXERCONTROL)malloc(sizeof MIXERCONTROL); 
 
MIXERLINECONTROLS mxlctrl = {sizeof mxlctrl, mxl.dwLineID, 
 
MIXERCONTROL_CONTROLTYPE_VOLUME, 1, sizeof MIXERCONTROL, pmxctrl}; 
 
if(!mixerGetLineControls((HMIXEROBJ) hmx, &mxlctrl, 
 
MIXER_GETLINECONTROLSF_ONEBYTYPE)){ 
 
// Found! 
 
DWORD cChannels = mxl.cChannels; 
 
if (MIXERCONTROL_CONTROLF_UNIFORM & pmxctrl->fdwControl) 
 
cChannels = 1; 
 
LPMIXERCONTROLDETAILS_UNSIGNED pUnsigned = 
 
(LPMIXERCONTROLDETAILS_UNSIGNED) 
 
malloc(cChannels * sizeof MIXERCONTROLDETAILS_UNSIGNED); 
 
MIXERCONTROLDETAILS mxcd = {sizeof(mxcd), pmxctrl->dwControlID, 
 
cChannels, (HWND)0, 
 
sizeof MIXERCONTROLDETAILS_UNSIGNED, (LPVOID) pUnsigned}; 
 
mixerGetControlDetails((HMIXEROBJ)hmx, &mxcd, 
 
MIXER_SETCONTROLDETAILSF_VALUE); 
 
// Set the volume to the middle  (for both channels as needed) 
 
pUnsigned[0].dwValue = pUnsigned[cChannels - 1].dwValue = 
 
(pmxctrl->Bounds.dwMinimum+pmxctrl->Bounds.dwMaximum)/2; 
 
mixerSetControlDetails((HMIXEROBJ)hmx, &mxcd, 
 
MIXER_SETCONTROLDETAILSF_VALUE); 
 
free(pmxctrl); 
 
free(pUnsigned); 
 

 
else 
 
free(pmxctrl); 
 
mixerClose(hmx); 
 

 
void SelectMic() 
 

 
// Open the mixer device 
 
HMIXER hmx; 
 
mixerOpen(&hmx, 0, 0, 0, 0); 
 
// Get the line info for the wave in destination line 
 
MIXERLINE mxl; 
 
mxl.cbStruct      = sizeof(mxl); 
 
mxl.dwComponentType = MIXERLINE_COMPONENTTYPE_DST_WAVEIN; 
 
mixerGetLineInfo((HMIXEROBJ)hmx, &mxl, 
 
MIXER_GETLINEINFOF_COMPONENTTYPE); 
 
// Find a LIST control, if any, for the wave in line 
 
LPMIXERCONTROL pmxctrl = (LPMIXERCONTROL)malloc(mxl.cControls * sizeof 
 
MIXERCONTROL); 
 
MIXERLINECONTROLS mxlctrl = {sizeof mxlctrl, mxl.dwLineID, 0, 
 
mxl.cControls, sizeof MIXERCONTROL, pmxctrl}; 
 
mixerGetLineControls((HMIXEROBJ) hmx, &mxlctrl, 
 
MIXER_GETLINECONTROLSF_ALL); 
 
// Now walk through each control to find a type of LIST control. This 
 
// can be either Mux, Single-select, Mixer or Multiple-select. 
 
DWORD i; 
 
for(i=0; i < mxl.cControls; i++) 
 
if (MIXERCONTROL_CT_CLASS_LIST == (pmxctrl[i].dwControlType 
 
&MIXERCONTROL_CT_CLASS_MASK)) 
 
break; 
 
if (i < mxl.cControls) { // Found a LIST control 
 
// Check if the LIST control is a Mux or Single-select type 
 
BOOL bOneItemOnly = FALSE; 
 
switch (pmxctrl[i].dwControlType) { 
 
case MIXERCONTROL_CONTROLTYPE_MUX: 
 
case MIXERCONTROL_CONTROLTYPE_SINGLESELECT: 
 
bOneItemOnly = TRUE; 
 

 
DWORD cChannels = mxl.cChannels, cMultipleItems = 0; 
 
if (MIXERCONTROL_CONTROLF_UNIFORM & pmxctrl[i].fdwControl) 
 
cChannels = 1; 
 
if (MIXERCONTROL_CONTROLF_MULTIPLE & pmxctrl[i].fdwControl) 
 
cMultipleItems = pmxctrl[i].cMultipleItems; 
 
// Get the text des*****ion of each item 
 
LPMIXERCONTROLDETAILS_LISTTEXT plisttext = 
 
(LPMIXERCONTROLDETAILS_LISTTEXT) 
 
malloc(cChannels * cMultipleItems * sizeof 
 
MIXERCONTROLDETAILS_LISTTEXT); 
 
MIXERCONTROLDETAILS mxcd = {sizeof(mxcd), pmxctrl[i].dwControlID, 
 
cChannels, 
 
(HWND)cMultipleItems, sizeof MIXERCONTROLDETAILS_LISTTEXT, 
 
(LPVOID) plisttext}; 
 
mixerGetControlDetails((HMIXEROBJ)hmx, &mxcd, 
 
MIXER_GETCONTROLDETAILSF_LISTTEXT); 
 
// Now get the value for each item 
 
LPMIXERCONTROLDETAILS_BOOLEAN plistbool = 
 
(LPMIXERCONTROLDETAILS_BOOLEAN) 
 
malloc(cChannels * cMultipleItems * sizeof 
 
MIXERCONTROLDETAILS_BOOLEAN); 
 
mxcd.cbDetails = sizeof MIXERCONTROLDETAILS_BOOLEAN; 
 
mxcd.paDetails = plistbool; 
 
mixerGetControlDetails((HMIXEROBJ)hmx, &mxcd, 
 
MIXER_GETCONTROLDETAILSF_VALUE); 
 
// Select the "Microphone" item 
 
for (DWORD j=0; j<cMultipleItems; j = j + cChannels) 
 
if (0 == strcmp(plisttext[j].szName, "Microphone")) 
 
// Select it for both left and right channels 
 
plistbool[j].fValue = plistbool[j+ cChannels - 1].fValue = 1; 
 
else if (bOneItemOnly) 
 
// Mux or Single-select allows only one item to be selected 
 
// so clear other items as necessary 
 
plistbool[j].fValue = plistbool[j+ cChannels - 1].fValue = 0; 
 
// Now actually set the new values in 
 
mixerSetControlDetails((HMIXEROBJ)hmx, &mxcd, 
 
MIXER_GETCONTROLDETAILSF_VALUE); 
 
free(pmxctrl); 
 
free(plisttext); 
 
free(plistbool); 
 

 
else 
 
free(pmxctrl); 
 
mixerClose(hmx); 
 
}



Alle Zeitangaben in WEZ +1. Es ist jetzt 08:57 Uhr.

Powered by vBulletin® (Deutsch)
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.