?
Solved

Microphone Boost

Posted on 2000-05-15
8
Medium Priority
?
1,543 Views
Last Modified: 2008-02-20
Hi,

Someone can tell me how can I using API functions (mixerXXX) turn on/off microphone boost? (Volume control->microphone->advanced->microphone boost)

PS: I'm using VC60 (OS Win9x/NT/2k)

Thanks

0
Comment
Question by:mahno
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
8 Comments
 
LVL 22

Expert Comment

by:CJ_S
ID: 2810429
The whole mixer-stuff is a LOT...you'd better look in the Help files for yourself, it's too much to expalin.
0
 
LVL 1

Expert Comment

by:yz
ID: 2810432
In platform SDK, there is a sample named MaxApp, it can switch the microphone boost on or off, you can check it's code.
0
 
LVL 1

Expert Comment

by:yz
ID: 2810435
sorry, not MaxApp, is MixApp.
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 1

Expert Comment

by:yz
ID: 2810446
sorry, not MaxApp, is MixApp.
0
 
LVL 1

Accepted Solution

by:
yz earned 400 total points
ID: 2810694
I made a test program, it runs ok in my computer, you can refer it.

#include <windows.h>
#include <mmsystem.h>

HMIXER                                          hMixer;
MIXERLINE                                    MixerLine;
MIXERCONTROL                              MixerControl;
MIXERLINECONTROLS                        MixerLineControls;
PMIXERCONTROL                              paMixerControls;
MIXERCONTROLDETAILS                        MixerControlDetails;
PMIXERCONTROLDETAILS_BOOLEAN      pMixerControlDetails_Boolean;
MIXERCAPS                                    MixerCaps;
MMRESULT                                    mmr;

void main()
      {
      UINT u,v, cConnections;

    mmr = mixerOpen(&hMixer, 0, 0, 0L, MIXER_OBJECTF_MIXER);

    mmr = mixerGetDevCaps((UINT)hMixer, &MixerCaps, sizeof(MixerCaps));

    for (u = 0; u < MixerCaps.cDestinations; u++)
            {
                  MixerLine.cbStruct      = sizeof(MixerLine);
                  MixerLine.dwDestination = u;

                  mmr = mixerGetLineInfo((HMIXEROBJ)hMixer, &MixerLine, MIXER_GETLINEINFOF_DESTINATION);

                  cConnections = (UINT)MixerLine.cConnections;
                  for (v = 0; v < cConnections; v++)
                        {
                        MixerLine.cbStruct      = sizeof(MixerLine);
                        MixerLine.dwDestination = u;
                        MixerLine.dwSource      = v;

                        mmr = mixerGetLineInfo((HMIXEROBJ)hMixer, &MixerLine, MIXER_GETLINEINFOF_SOURCE);

                        if (MIXERLINE_COMPONENTTYPE_SRC_MICROPHONE == MixerLine.dwComponentType)
                              goto L_goon;
                        }
            }
L_goon:
    paMixerControls = (PMIXERCONTROL)malloc(sizeof(MIXERCONTROL) * MixerLine.cControls);
      
    MixerLineControls.cbStruct       = sizeof(MixerLineControls);
    MixerLineControls.dwLineID       = MixerLine.dwLineID;
    MixerLineControls.cControls      = MixerLine.cControls;
    MixerLineControls.cbmxctrl       = sizeof(MIXERCONTROL);
    MixerLineControls.pamxctrl       = paMixerControls;
   
    mmr = mixerGetLineControls((HMIXEROBJ)hMixer, &MixerLineControls, MIXER_GETLINECONTROLSF_ALL);      
      
      for (u = 0; u < MixerLine.cControls; u++)
            if (NULL != strstr(paMixerControls[u].szName, "Mic Boost"))
                  break;
      
    MixerLineControls.cbStruct    = sizeof(MixerLineControls);
    MixerLineControls.dwControlID = paMixerControls[u].dwControlID;
    MixerLineControls.cbmxctrl    = sizeof(MixerControl);
    MixerLineControls.pamxctrl    = &MixerControl;

    mmr = mixerGetLineControls((HMIXEROBJ)hMixer, &MixerLineControls, MIXER_GETLINECONTROLSF_ONEBYID);
      
      free(paMixerControls);

      pMixerControlDetails_Boolean = (PMIXERCONTROLDETAILS_BOOLEAN)malloc(MixerLine.cChannels * sizeof(MIXERCONTROLDETAILS_BOOLEAN));

    MixerControlDetails.cbStruct       = sizeof(MixerControlDetails);
    MixerControlDetails.dwControlID    = MixerControl.dwControlID;
    MixerControlDetails.cChannels      = MixerLine.cChannels;
    MixerControlDetails.cMultipleItems = MixerControl.cMultipleItems;
    MixerControlDetails.cbDetails      = sizeof(sizeof(MIXERCONTROLDETAILS_BOOLEAN));
    MixerControlDetails.paDetails      = pMixerControlDetails_Boolean;

    mmr = mixerGetControlDetails((HMIXEROBJ)hMixer, &MixerControlDetails, 0L);
      
// True to turn on boost, False to turn off
      pMixerControlDetails_Boolean[0].fValue = true;  

    mmr = mixerSetControlDetails((HMIXEROBJ)hMixer, &MixerControlDetails, 0L);

      free(pMixerControlDetails_Boolean);
      }      
0
 
LVL 1

Author Comment

by:mahno
ID: 2813489
Hi yz,

On my computer it's working only when I change "Mic Boost" to "Microphone Boost". I need a program that works on every PC. The parameter "szShortName" is equal to "Boost". Can I be sure that short name will be the same on every pc (independently of Windows version and regional settings(language)).

Thanks,
  mahno
0
 
LVL 1

Author Comment

by:mahno
ID: 2813513
I just a test this program on same pc - short name does not same, controlID too :( any suggestions?

Regards,
  mahno
0
 
LVL 1

Author Comment

by:mahno
ID: 2814186
thanks yz,

I solve my problem by changing
if (NULL != strstr(paMixerControls[u].szName, "Mic Boost"))
to
if (paMixerControls[u].dwControlType == MIXERCONTROL_CONTROLTYPE_ONOFF)

PS: U can take a look at my new multimedia question in "C++ Topic Area"

regards,
  mahno
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Errors will happen. It is a fact of life for the programmer. How and when errors are detected have a great impact on quality and cost of a product. It is better to detect errors at compile time, when possible and practical. Errors that make their wa…
Written by John Humphreys C++ Threading and the POSIX Library This article will cover the basic information that you need to know in order to make use of the POSIX threading library available for C and C++ on UNIX and most Linux systems.   [s…
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.
Suggested Courses
Course of the Month14 days, 11 hours left to enroll

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question