Solved

Microphone Boost

Posted on 2000-05-15
8
1,528 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
Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

 
LVL 1

Expert Comment

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

Accepted Solution

by:
yz earned 100 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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Article by: SunnyDark
This article's goal is to present you with an easy to use XML wrapper for C++ and also present some interesting techniques that you might use with MS C++. The reason I built this class is to ease the pain of using XML files with C++, since there is…
What is C++ STL?: STL stands for Standard Template Library and is a part of standard C++ libraries. It contains many useful data structures (containers) and algorithms, which can spare you a lot of the time. Today we will look at the STL Vector. …
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

813 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now