Solved

Microphone Boost

Posted on 2000-05-15
8
1,515 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
Comment Utility
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
Comment Utility
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
Comment Utility
sorry, not MaxApp, is MixApp.
0
 
LVL 1

Expert Comment

by:yz
Comment Utility
sorry, not MaxApp, is MixApp.
0
Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

 
LVL 1

Accepted Solution

by:
yz earned 100 total points
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Introduction This article is a continuation of the C/C++ Visual Studio Express debugger series. Part 1 provided a quick start guide in using the debugger. Part 2 focused on additional topics in breakpoints. As your assignments become a little more …
C++ Properties One feature missing from standard C++ that you will find in many other Object Oriented Programming languages is something called a Property (http://www.experts-exchange.com/Programming/Languages/CPP/A_3912-Object-Properties-in-C.ht…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

771 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

15 Experts available now in Live!

Get 1:1 Help Now