🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.cppbuilder.multimedia
3 messages
3 total messages Started by Michael Kutscher Tue, 13 Apr 2004 14:41
Mixer-Tragedy
#607
Author: Michael Kutscher
Date: Tue, 13 Apr 2004 14:41
97 lines
3634 bytes
Hi,

I'm trying to set the microphone-input-volume and converted a piece of 
delphi-code for cpp-builder.

There is only one problem: It dosn't work :-(

Do You have any clue, whats wrong?

Thanks in advance
Michael Kutscher


Here is the code

bool SetMicrophoneVolume(DWORD bValue)
{
   HMIXER hMix;
   MIXERLINECONTROLS mxlc;
   MIXERCONTROLDETAILS mxcd;
   MIXERCONTROLDETAILS_UNSIGNED vol ;
   MIXERCONTROL mxc ;
   MIXERLINE mxl ;
   int intRet;
   int nMixerDevs;
   // Check if Mixer is available
   // �berpr�fen, ob ein Mixer vorhanden
   nMixerDevs = mixerGetNumDevs();
   if (nMixerDevs < 1) return false;

   // open the mixer
   intRet = mixerOpen(&hMix, 0, 0, 0, 0);
   if (intRet == MMSYSERR_NOERROR)
   {
     ZeroMemory(&mxl,sizeof(mxl));
     mxl.dwComponentType = MIXERLINE_COMPONENTTYPE_SRC_MICROPHONE;
     mxl.cbStruct = sizeof(mxl);

     // get line info
     intRet = mixerGetLineInfo(hMix, &mxl, 
MIXER_GETLINEINFOF_COMPONENTTYPE);

     if (intRet == MMSYSERR_NOERROR)
     {
       ZeroMemory(&mxlc, sizeof(mxlc));
       mxlc.cbStruct = sizeof(mxlc);
       mxlc.dwLineID = mxl.dwLineID;
       mxlc.dwControlType = MIXERCONTROL_CONTROLTYPE_VOLUME;
       mxlc.cControls = 1;
       mxlc.cbmxctrl = sizeof(mxc);

       mxlc.pamxctrl = &mxc;
       intRet = mixerGetLineControls(hMix, &mxlc, 
MIXER_GETLINECONTROLSF_ONEBYTYPE);

       if (intRet == MMSYSERR_NOERROR)
       {
        // Microphone Name
        Form1->Label1->Caption = mxlc.pamxctrl->szName;
        vol.dwValue = bValue;

         // Min/Max Volume
         //Form1->Label2->Caption = IntToStr(mxc.Bounds.dwMinimum) + 
"->" + IntToStr(mxc.Bounds.dwMaximum);
         ZeroMemory(&mxcd, sizeof(mxcd));
         mxcd.dwControlID = mxc.dwControlID;
         mxcd.cbStruct = sizeof(mxcd);
         mxcd.cMultipleItems = 0;
         mxcd.cbDetails = sizeof(vol);
         mxcd.paDetails = &vol;
         mxcd.cChannels = 1;

         // vol.dwValue := mxlc.pamxctrl.Bounds.lMinimum; Set min. 
Volume           // Minimum setzen



         // vol.dwValue := mxlc.pamxctrl.Bounds.lMaximum; Set max. 
Volume // Maximum setzen

         intRet = mixerSetControlDetails(hMix, &mxcd, 
    MIXER_SETCONTROLDETAILSF_VALUE);
         if (intRet != MMSYSERR_NOERROR)
           ShowMessage("SetControlDetails Error");

//  I get Error 1025 here and nothing happens :-(



       }
       else
         ShowMessage("GetLineInfo Error");
     }
     intRet = mixerClose(hMix);
   }
   return intRet;
}
Re: Mixer-Tragedy
#608
Author: Remy Lebeau (TeamB)
Date: Tue, 13 Apr 2004 17:45
15 lines
1326 bytes
"Michael Kutscher" <spam.ignore@pc-coach.de> wrote in message
news:c5gu9q$16k$03$1@news.t-online.com...

>          intRet = mixerSetControlDetails(hMix, &mxcd,
>     MIXER_SETCONTROLDETAILSF_VALUE);
>          if (intRet != MMSYSERR_NOERROR)
>            ShowMessage("SetControlDetails Error");
>
> //  I get Error 1025 here and nothing happens :-(

Error 1025 is MIXERR_INVALCONTROL.


Gambit
Re: Mixer-Tragedy
#609
Author: Michael Kutscher
Date: Wed, 14 Apr 2004 09:22
23 lines
1856 bytes
Hi,

Remy Lebeau (TeamB) schrieb:
> Error 1025 is MIXERR_INVALCONTROL.

Thanks. I noticed, that I get this error with

         mxcd.dwControlID = mxlc.dwControlID;

I changed it to

         mxcd.dwControlID = mxc.dwControlID;

and now the control _seems_ to be OK... there is no error-code.
I can set the value, I can retrieve it and see that it has been changed.
Unfortionatly, thats all, that seems to happen: When I activate the 
windows-mixer-panel, the microphone-fader (and everything else) shows 
just the old value.

Can You give me a further clue?

Thanks in Advance
Michael
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads