?
Solved

Microphone Boost

Posted on 2000-05-15
8
Medium Priority
?
1,552 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
  • 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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
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

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!

Question has a verified solution.

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

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…
Article by: evilrix
Looking for a way to avoid searching through large data sets for data that doesn't exist? A Bloom Filter might be what you need. This data structure is a probabilistic filter that allows you to avoid unnecessary searches when you know the data defin…
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.
Suggested Courses

850 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