🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.multimedia
Article #607

Mixer-Tragedy

#607
From: 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;
}
Technical Details
Message-ID: <c5gu9q$16k$03$1@news.t-online.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!news.glorb.com!newsfeed00.sul.t-online.de!newsmm00.sul.t-online.de!t-online.de!news.t-online.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII
X-Google-Thread: 10d0fc,97738f8476dc628d,start
X-Google-Attributes: gid10d0fc,public
X-Google-ArrivalTime: 2004-04-13 07:43:12 PST
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!news.glorb.com!newsfeed00.sul.t-online.de!newsmm00.sul.t-online.de!t-online.de!news.t-online.com!not-for-mail
From: Michael Kutscher <spam.ignore@pc-coach.de>
Newsgroups: borland.public.cppbuilder.multimedia
Subject: Mixer-Tragedy
Date: Tue, 13 Apr 2004 16:41:07 +0200
Organization: T-Online
Lines: 98
Message-ID: <c5gu9q$16k$03$1@news.t-online.com>
Reply-To: spam.ignore@pc-coach.de
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: news.t-online.com 1081867386 03 1236 qEITGeuOSXeRUAE 040413 14:43:06
X-Complaints-To: usenet-abuse@t-online.de
X-ID: EBDoUMZCgepPLm3puHbFqgK-e+h7j9HnxixVrK+5o5MeKbYtu1gFZy
User-Agent: Mozilla/5.0 (Windows; U; Win 9x 4.90; de-DE; rv:1.5) Gecko/20031013 Thunderbird/0.3
X-Accept-Language: de-de, de-at, de, en-us, en