Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Microphone Boost

Posted on 2000-05-15
8
Medium Priority
?
1,550 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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

When writing generic code, using template meta-programming techniques, it is sometimes useful to know if a type is convertible to another type. A good example of when this might be is if you are writing diagnostic instrumentation for code to generat…
Container Orchestration platforms empower organizations to scale their apps at an exceptional rate. This is the reason numerous innovation-driven companies are moving apps to an appropriated datacenter wide platform that empowers them to scale at a …
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

618 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