 |
|

|
Hi, Alex- What is the license on this code? Some people I know are looking into distributing it for commercial purposes. Thanks!
|
|
|
|
|

|
This article works fine for application level volume control in windows 7 but I need Master volume control in windows 7? any help
|
|
|
|

|
I'm working on an application which was written in VB using MCI.OCX and winmm.dll library. It runs on Windows 98 successfully but cause problems on Windows XP. Do you know how I can make the application compatible for Windows XP?
Always looking for seniors help and guidance.
|
|
|
|

|
I have been using this library under XP for years with great success. Thanks Alex. I have recently become aware that the volume control doesn't set the volume when running under Window Vista. I know that they rewrote the entire sound system in Vista, but all the calls look like they are working when you examine the results under a debugger.
Anyhow, has nyone been able to get this to go under Vista? If not, I would be interested in what code libraries people are using under vista to control volume. I need to control the volume for both the CD and wave devices independantly.
In order to support setting the balance, I also changed the SetVolume method to this (which has been working under XP for years):
void CVolumeOutWave::SetCurrentVolume( DWORD dwRightValue, DWORD dwLeftValue )
{
if ( !m_bAvailable || (dwRightValue<m_dwMinimalVolume) || (dwRightValue>m_dwMaximalVolume) ||
(dwLeftValue<m_dwMinimalVolume) || (dwLeftValue>m_dwMaximalVolume) )
return;
MIXERCONTROLDETAILS_UNSIGNED* aDetails = (MIXERCONTROLDETAILS_UNSIGNED*)malloc(m_nChannelCount*sizeof(MIXERCONTROLDETAILS_UNSIGNED));
if ( !aDetails )
return;
for ( int i = 0; i < m_nChannelCount; i++ )
{
if (i < (m_nChannelCount / 2))
{
aDetails[i].dwValue = dwLeftValue;
}
else
{
aDetails[i].dwValue = dwRightValue;
}
}
MIXERCONTROLDETAILS ControlDetails;
memset( &ControlDetails, 0, sizeof(MIXERCONTROLDETAILS) );
ControlDetails.cbStruct = sizeof(MIXERCONTROLDETAILS);
ControlDetails.dwControlID = m_dwVolumeControlID;
ControlDetails.cChannels = m_nChannelCount;
ControlDetails.cMultipleItems = 0;
ControlDetails.cbDetails = sizeof(MIXERCONTROLDETAILS_UNSIGNED);
ControlDetails.paDetails = &aDetails[0];
MMRESULT mmResult = mixerSetControlDetails( (HMIXEROBJ)m_dwMixerHandle, &ControlDetails, MIXER_SETCONTROLDETAILSF_VALUE );
free( aDetails );
if ( mmResult != MMSYSERR_NOERROR )
{
TRACE(".WaveOutputVolume: FAILURE: Could not set volume(%d) mmResult=%d\n", dwRightValue, dwLeftValue, mmResult );
}
}
|
|
|
|

|
How to use the callback function to update a control like a text field in a dialog? I am a beginner and hope somebody can help.
|
|
|
|

|
hi
how can i control the sound of left and right speaker by vc++/mfc.Actually i want to send different sound at same time on left and right speaker.
if anybody reply me i will obliged
hi
|
|
|
|

|
Your class work excellent with windows xp but there is some problem in 2000,
when i run program it give following messages which u have included.
error: CVolumeInXXX::EnumerateInputLines
error: uMicrophoneLineIndex = -1
error: !ob_MicroPhoneVolume || !ob_MicroPhoneVolume->IsAvailable()
plz tell me wht shall i do for this
|
|
|
|

|
I want to make a dll which i can use with Liberty Basic.
I'm still a begginer so you might think this is easy but for me it isn't
Here is the code. It only reports one error but i can't fix that because i can't find the error?
PS: There is probably lots of errors in my code
#include iostream.h
#include stdlib.h
#include windows.h>
EXTERN_C __declspec(dllexport) LONG Jacina (LONG);
BOOL WINAPI __declspec(dllexport) LibMain (HINSTANCE hInst, DWORD Reason, LPVOID Reserved)
{
if(Reason==DLL_PROCESS_ATTACH)
{
return TRUE;
}
if(Reason==DLL_PROCESS_DETACH)
{
return TRUE;
}
return FALSE;
}
EXTERN_C __declspec(dllexport) LONG Jacina ( LONG jaci )
{
long lRet;
lRet = void SetCurrentVolume( DWord jaci );
return lRet;
}
|
|
|
|
|

|
I need your hand so much !Would you do me a favor to show me how to use those Classes above!Thank you very much!
Please mail me:guoliangzhen2005@163.com,if you have time .
|
|
|
|

|
I want to Diable Microphone, But the code doesn't Support it! Could you Help me!
|
|
|
|

|
I love your article and have another question.
I used Enable() method and It always chose the Aux Recording-in. For my general idea, It should choose MIC-in or Line-In. Is it right? If I am wrong, comment me. What's the purpose of Enable() in this class?
Thank you.
|
|
|
|

|
Hi,
Your MasterVolume control works well. But microphone control doesn't work on Win-XP.
It shows following lines of error while debugging:
MasterOutputVolume: Initializing for Source MasterOut Line ..
.MasterOutputVolume: "Master Volume" Volume control for the Speakers Source Line adopted.
.MasterOutputVolume: Enabling Line: Speakers Line control "Master Mute"(0x20010002) has been set to 0.
.InputXxxVolume: Initializing for the Source Line (-1) ..
.InputXxxVolume: FAILURE: Invalid Source Line index passed.
Loaded 'C:\WINDOWS\wsec32hk.dll', no matching symbolic information found.
I am not getting what the problem is? The code works on WIN-2000. I am using CMedia audio hardware.
Please reply me soon.
Thanks again,
Virendra
|
|
|
|

|
Hi,
This progem is working fine with a classic sound card,
but it doesn t work with a usb headset , plantronics DSP 400,
If I change the input, then the CD audio output is changed, and the Master volume is muted !!!
any idea ?
|
|
|
|

|
Hi,
I implemented a simple MFC dialog, and tried to incorporate this volume manipulation source into the program. When I tried to pass the callback function in, as per the example,
pMasterVolume->RegisterNotificationSink(MasterVolChanged, (DWORD) 0);
I get the following error:
error C2664: 'RegisterNotificationSink' : cannot convert parameter 1 from 'void (unsigned long,unsigned long)' to 'void (__stdcall *)
(unsigned long,unsigned long)'
None of the functions with this name in scope match the target type
I seem to have followed your instructions, can anyone tell me where I might be going wrong?
Thanks,
Dave
|
|
|
|

|
There are Enable() and Disable() methods.
But how to determine whether volume is currently enabled or disabled?
|
|
|
|

|
I'm getting many (100+)compile Errors in VolumeInXXX
WAVEFORMATEX, HWAVEIN, MMRESULT, HMIXEROBJ, etc.
I saw an earlier post with this question, but no reply. Is there a library or a header file that I'm missing?
I put these in the VolumeInXXX.cpp file
#pragma comment(lib, "winmm.lib") //RB413 For MicVolume Function
#include "StdAfx.h"
#include "IVolume.h"
#include "VolumeInXXX.h"
And put these toward the end of stdafx.h
#include "windows.h"
#include "mmSystem.h" //RB413 Added for Mic Volume Routine
#pragma comment(lib, "winmm.lib")
Any help is appreciated.
----------------------------------------------------------------
The Microphone control code is as follows (yet to be tested)
#pragma comment(lib, "winmm.lib") //RB413 For MicVolume Function
#include "Ivolume.h"
#include "VolumeInXXX.h"
extern Ivolume;
extern CVolumeInXXX;
bool CALLBACK EnumInputLineProc( UINT uLineIndex, MIXERLINE* pLineInfo, DWORD dwUserValue );
void Class::SetMicVolume(int uLineIndex)
{
// set the microphone volume in 1% increments (Range 0 - 100)
// Initialization
UINT uMicrophoneLineIndex = (UINT)-1;
if ( !CVolumeInXXX::EnumerateInputLines( EnumInputLineProc, (DWORD)&uMicrophoneLineIndex ) )
{
// handle error
}
if ( uMicrophoneLineIndex == (UINT)-1 )
{
// Error: mic volume'ing is not available.
}
IVolume* pMicrophoneVolume = (IVolume*)new CVolumeInXXX( uMicrophoneLineIndex );
if ( !pMicrophoneVolume || !pMicrophoneVolume->IsAvailable() )
{
// handle error
}
// Go on and use pMicrophoneVolume to manipulate the volume
pMicrophoneVolume->Enable();
pMicrophoneVolume->SetCurrentVolume((DWORD) 655 * uLineIndex); //65535 = max
}
bool CALLBACK EnumInputLineProc( UINT uLineIndex, MIXERLINE* pLineInfo, DWORD dwUserValue )
{
if ( pLineInfo->dwComponentType == MIXERLINE_COMPONENTTYPE_SRC_MICROPHONE )
{
*((UINT*)dwUserValue) = uLineIndex;
return false;
}
return true;
}
|
|
|
|

|
Finally got the code working...
But I want to be able to control the volume of the playback of the line-in (not recording)
CVolumeOutWave does the wave... how can I make it work for line-in (or microphone?)
|
|
|
|

|
Hi,
I need to display the volume meter of current audio level coming from input devices like Microphone, Sound Card. The volume level will be displayed between 1 to 100 %. I am little new to MFC and I want to use your VolumeInXXX classes.
Can you please provide any sample application on How to use your classes to get the audio level from microphone at regular timer interval say 1 second and display the current volume level in Progress bar?
Thanks
|
|
|
|

|
Hi. I'm pleased for your article. Thanks Alex.
I have made AVWizard to ActiveX with your classes, But when AVWizard host IE is closed, it occur unexpected error. So I found that the CVolumeOutMaster's destructor didn't called. Because IVolume interface hasn't the virtual destructor. So I modified the IVolume interface.
insert this line into the IVolume interface.
virtual ~IVolume() {}
|
|
|
|

|
Thanks for the code, all I wanted to write was a couple of line command line EXE that set my main volume to 5% of the maximum (as my sound-card drivers default to 100% for some reason - and until new ones come out I'm in danger of getting 'BLASTED' in my ears when I forget!!
This is it:
int _tmain(int argc, _TCHAR* argv[])
{
// set the mixer master volume to 5% of max
IVolume* pMasterVolume = (IVolume*)new CVolumeOutMaster();
pMasterVolume->SetCurrentVolume( (DWORD)65535 * 0.05f );
return 0;
}
Thanks very much!
|
|
|
|

|
Hi, first thing to say: i'm a newbie so don't know a lot. I would like to use your program, and followed your instructions. But when I import mmsystem.h he gives 89 errors when trying to build. I use .NET
|
|
|
|

|
Hi,everyone!
I have used your class of control volumn in WinXP,it works well.But when i try to used in WinCE,it can't compiles.Could you give me some help?
Thank you.
|
|
|
|

|
Hi,
I have just tried to compile the Mixer program, but C++ complains about a header file (stdafx.h) that is missing. Can it be downloaded from anywhere?
|
|
|
|

|
thanx for the given class... but i want to know about the classes which gives the functionality to interact with the sound divice so i can work with the volume quality...i want to increase the volume with the help of the slider so plz tell me such classes which provides such functionality... thanx
|
|
|
|

|
I created a small console utility in win nt using your class.
But I am finding that it does not work when the audio device
is being used, only when it is not in use.
Any help is appreciated
regards
Anand
|
|
|
|

|
HI,
I can't compile the classes in my project. I have an MFC application, and I have included IVolume.h, VolumeInXXX.h and VolumeInXXX.cpp in my project. I have included mmSystem.h and VolumeOutMaster.h in my StdAfx.h file and I have linked to winmm.lib. When compiling; I get over 100 errors for VolumeInXXX.cpp (here are some of them):
:\Code\Volume Control\Volume\VolumeInXXX.cpp(24) : error C2065: 'WAVEFORMATEX' : undeclared identifier
C:\Code\Volume Control\Volume\VolumeInXXX.cpp(24) : error C2065: 'pwfe' : undeclared identifier
C:\Code\Volume Control\Volume\VolumeInXXX.cpp(25) : error C2448: '' : function-style initializer appears to be a function definition
C:\Code\Volume Control\Volume\VolumeInXXX.cpp(78) : error C2065: 'mixerGetNumDevs' : undeclared identifier
C:\Code\Volume Control\Volume\VolumeInXXX.cpp(81) : error C2065: 'HWAVEIN' : undeclared identifier
C:\Code\Volume Control\Volume\VolumeInXXX.cpp(81) : error C2146: syntax error : missing ';' before identifier 'hwaveIn'
C:\Code\Volume Control\Volume\VolumeInXXX.cpp(81) : error C2065: 'hwaveIn' : undeclared identifier
C:\Code\Volume Control\Volume\VolumeInXXX.cpp(82) : error C2065: 'MMRESULT' : undeclared identifier
C:\Code\Volume Control\Volume\VolumeInXXX.cpp(82) : error C2146: syntax error : missing ';' before identifier 'mmResult'
C:\Code\Volume Control\Volume\VolumeInXXX.cpp(82) : error C2065: 'mmResult' : undeclared identifier
.
.
.
etc.
Does anyone know why? Any help is very appreciated!
Regards,
Annette Skaar
|
|
|
|

|
Hi,
I downloaded your class to control volume of line in. I can't get it to work using MIXERLINE_COMPONENTTYPE_SRC_LINE. I tried using MIXERLINE_COMPONENTTYPE_SRC_WAVEOUT and it changes the balance of master volume.
Anyone has an idea why it does that ?
thanks.
|
|
|
|

|
Hi, The class does not work with usb microphone to controla the recording volume
Vk
|
|
|
|

|
Hi,
Even though the code seems to be good, but it seems to be bit hard for the programmers to implement. If any of you guys have used it, please post the sample project or send it to my email address, santu_srisoft@yahoo.com
with regards
a.santosh
|
|
|
|

|
I want to Control the Mic Recording Volume
I use the MIXERCONTROL_COMPONENTTYPE_VOICE_IN but i faild
How can i do that?
|
|
|
|

|
When I launch a program that uses wave-in-device,
the application that is given by you is
finished unproperly.
Your demo app. is launched properly under not using wave-in-device..
Why is it?
And...How can I modify your app. to avoid such things?
|
|
|
|

|
Where does the pLineInfo get initalized for the EnumInputLineProc ? and I'm getting the following error:
error C2664: 'EnumerateInputLines' : cannot convert parameter 1 from 'bool (unsigned int,struct tagMIXERLINEA *,unsigned long)' to 'bool (__stdcall *)(unsigned int,struct tagMIXERLINEA *,unsigned long)'
None of the functions with this name in scope match the target type
|
|
|
|

|
Alex, I use your class, Thank you very much.
this class is normal in winnt, but mute microphone is invalid in win2000?
why?
|
|
|
|

|
where should i find a stdafx.h files??? plz
thank u very much....
|
|
|
|

|
where should i find a stdafx.h files??? plz
thank u very much....
|
|
|
|

|
Thanks for your works.
|
|
|
|

|
I've developped one Dialog based App used your codes for just mute/unmute, increase and decrease volume. But the App cost about 2.1M memory reported by windows2000 task manager. Is it normal?
Thank you.
cookie2k
|
|
|
|

|
Please tell the way to display equalize when play WAV, MP3... file
Thanx
Take a look at me now
|
|
|
|

|
Why? I can't execute in win98 when Realplayer is runing at sametime.
And It try execute in Win ME that is allright.
However It can execute in win98 without Realplayer is running.
I try to find questions, When I running to
mmResult = waveOutOpen( &hwaveOut, WAVE_MAPPER, &WaveFmt, 0L, 0L, CALLBACK_NULL );
It can't return "hwaveOut".
Colud you help me,How to do? Thank you a lot.
|
|
|
|

|
This was just where I was looking for. But why didn't you put most of the code in the base class? Anyway, I've been doing that now. One question came up to me, while doing that: Why do you need the global g_pThis pointer?
Many Thanks,
Patrick
|
|
|
|

|
it's a good libraries, thank you very much. I need to know
how to use your classes to control more than one audio board on a computer.
Thank you
|
|
|
|
|

|
Great work !!!
Mixer manipulation is simple for the user, but hard to implement for the programmer.
The callback functions are pretty cool and will be of good use for me
|
|
|
|

|
Thanks a lot! U saved me a lot of pain
|
|
|
|
 |