Brad Hoskins

We are trying to port a legacy audio app over to Vista. This app captures and plays audio using the waveXxx functions. Everything works well except for the capture endpoint for microphone volume. If I set the microphone volume to zero before application startup, my application will adjust the volume to 50. When I open the input stream with waveInOpen after initializing the endpoint, the volume goes back to zero. If I set the input volume to 100 before application startup, the app initializes to 50 and, again, when the input stream is opened with waveInOpen the volume goes to 100. I can set the volume to any value before the application is started and once the input stream is opened, the volume goes to that value.

I have an IAudioEndpointCallback class defined and the OnNotify is validating my findings.

This is driving me crazy! Master Volume, application volume, microphone output volume all work fine except for this anomaly. Is there some sort of incompatibility with waveXxx functions Has any ever tried the use the waveInxx functions along with instantiating an capture endpoint




Re: Vista Pro-Audio Application Development Using legacy waveXxx functions in Vista

Larry Osterman

How are you setting the microphone volume to 0

If you're using the mixer APIs, it should work perfectly. If you're using mmsys.cpl, then the behavior you're describing is expected for Vista (technical details: we're not listening for volume change notifications unless you're actively streaming audio, so we miss the changes from when mmsys.cpl isn't running).

If you notice, the volume is snapping back to the last volume that was set during capture.

Possible solutions:

#1: Use the mixer APIs to change the volume on the Mic or Line In source line - those use the same volume control that the waveInXxx APIs use so they should remain in sync all the time.

#2: Close your waveInHandle if you're not actively capturing - this isn't a perfect solution.

This issue may be fixed in a future version of Windows.





Re: Vista Pro-Audio Application Development Using legacy waveXxx functions in Vista

Brad Hoskins

In our testing we are setting the volume to an arbitrary value (in this case zero) with mmsys.cpl
We then start our application and use the WASAPI EndpointVolume interface to set the capture volume to 50%. This is where the legacy code is called. When the user starts the capture process, we call waveInOpen and subsequent supporting calls for start and stop of capture. This is where the volume jumps.

Would is be prudent to just port all of the waveXXxxx calls to WASAPI Would the volume jump disappear We use software AGC during the capture process and would like to have the capture volume controlled by this process and not be modified by the underlying APIs.

In your statement "This issue may be fixed in a future version of Windows". Does this mean an architectural issue or bug

Larry, Thanks for all your help on this and your overall guidance in the Vista Audio realm. It is truly invaluable!

Brad




Re: Vista Pro-Audio Application Development Using legacy waveXxx functions in Vista

Larry Osterman

The volume jump wouldn't disappear if you moved to WASAPI, but if you changed your code to use the mixer APIs to set the volume the problem would go away.

In addition, if you only changed the capture volume while capturing you wouldn't see a problem.

Vista works the way that you're seeing. So it's by design for Vista (in other words, IMHO it's unlikely that you'll be able to get a fix for it). If you'd like to, you can contact PSS and see if you can convince them that you need a fix for the problem.

In a future version of windows, this behavior might change, I can't speculate about what features might be included in a future version.





Re: Vista Pro-Audio Application Development Using legacy waveXxx functions in Vista

suneeth

hi,

actually i've developed an application which controls the volume controls of the sound card. My code seems to be working fine without any snags or bugs on all sound cards in windows XP. But when i've tried on windows Vista all hell broke loose. No api is working and i'm unable to access any lines like master control or microphone or wave lines......i have used all mixer realted apis defiend in MMSYSTEM.H .......can any one please help me in this regard...






Re: Vista Pro-Audio Application Development Using legacy waveXxx functions in Vista

Larry Osterman

See the above thread. The reason you're having problems is that on Vista, the mixer is virtualized and only controls the volume of audio rendered by the application.

If you want to see the hardware mixer controls, either run your app in XP compatibility mode (which will switch the mixer to run using the actual audio hardware controls), or you can use the new IDeviceTopology API to directly access the hardware controls.

To control the master volume, you should use the IAudioEndpointVolume API - many audio solutions don't contain hardware volume controls, and thus the DeviceTopology (which only exposes the hardware support) won't be able to expose those controls.





Re: Vista Pro-Audio Application Development Using legacy waveXxx functions in Vista

jbdavis

We are seeing the same thing.

I am pretty sure that the solution #2 will not work. We are closing the waveInHandle before each recording but if the user changes the volume level using the control panel and then we issue a waveInOpen() the recording level jumps back to its previous setting.

It wouldn't be that hard to incorporate the MIXER API enough to be able to set the volume level based on the current setting before recording.

It is either that or we tell the users to only change level while recording





Re: Vista Pro-Audio Application Development Using legacy waveXxx functions in Vista

jbdavis

I have done some testing with the mixer API. I am not sure exactly how a specific recording endpoint level maps to the mixer API volume control.

There are serveral MIXERLINE_COMPONENTTYPE_SRC_ constants. There is a _MICROPHONE and _LINE type defined. Do I assume that if there is a single microphone and line-in endpoint that these map to each other and setting the volume for this source they will remain in sync What if there are multiple microphone endpoints Does it matter which one is set as default

Thanks.





Re: Vista Pro-Audio Application Development Using legacy waveXxx functions in Vista

jbdavis

We were able to solve the problem by using the Vista Audio API to get the current Recording Endpoint volume level and then after the call to waveInOpen() we set the recording endpoint volume level using the Vista Audio API. This keeps the two in sync. Basically the same thing as the suggestion to only change the volume while the capture is in progress but we are doing it programatically.

Jeff





Re: Vista Pro-Audio Application Development Using legacy waveXxx functions in Vista

Vish_hss

Larry,
W are using legacy MIXER function in our application.

Our audio application implements ˇ°Sidetoneˇ± feature. To implement the Sidetone feature, we need a control to access ( mute/un-mute ) Microphone sourceline of the Headset.

To access the Microphone Sourceline of the USB headset we are using the Mixer API's.

But unfortunately on Vista, USB headset mixer doesn't list the source line of the type MIXERLINE_COMPONENTTYPE_SRC_MICROPHONE. (On Vista, USB head set mixer only displays sourcelines for Source Compact Disk and Source Wave Out.) Could you please let me know the ways to control USB head set's Microphone


Regards,
Vish





Re: Vista Pro-Audio Application Development Using legacy waveXxx functions in Vista

Larry Osterman

I think you're only looking at mixer device 0. You should have a mixer device for each of your inputs and one for each of your outputs; the CD and wave out source are only present on render devices.

You should be able to use the mixer APIs to mute the microphone once you find the right device.





Re: Vista Pro-Audio Application Development Using legacy waveXxx functions in Vista

Vish_hss

Larry,
I think my question is not clear. I would like to programmetically control (Mute and Volume) the pass through from headset mic to headset earphone (SideTone). On XP I am following below steps to get access to headset Mic

  • Get the Headset MixerId
  • Open the Mixer
  • Get the mixerGetLineInfo for the component type of MIXERLINE_COMPONENTTYPE_DST_HEADPHONES
  • Then for this destination line, I look for a Microphone Source Line.
Source snapshot:


MIXERLINE ml;

::memset (&ml,0,sizeof (MIXERLINE));
ml.cbStruct = sizeof (MIXERLINE);
ml.dwComponentType = MIXERLINE_COMPONENTTYPE_DST_HEADPHONES
mmr = ::mixerGetLineInfo ((HMIXEROBJ)m_hMixer,&ml,MIXER_GETLINEINFOF_COMPONENTTYPE);

// check for actual microphone source line
int nConnections = static_cast<int>(ml.cConnections);
for (int i = 0; i < nConnections; i++)
{
::memset (&ml,0,sizeof (MIXERLINE));
ml.cbStruct = sizeof (MIXERLINE);
ml.dwDestination = ml.dwDestination;
ml.dwSource = i;

if (::mixerGetLineInfo ((HMIXEROBJ)m_hMixer,&ml,MIXER_GETLINEINFOF_SOURCE) == MMSYSERR_NOERROR)
{
if (ml.dwComponentType == MIXERLINE_COMPONENTTYPE_SRC_MICROPHONE)
{
m_dwSidetoneLineID = ml.dwLineID;
LOG("Speakers have separate mic source line\n");

m_bMicSidetone = TRUE;
}




Following is the list of all Mixer devices available on Vista System



Mixer device 0 details ...
Name: M
Line Id: 4294901760
Component Type: Destination Headphones
Num of Controls: 2
Control Information:
Name: M
Control Id: 1
Type: Mute Switch
Value: 0
Name: V
Control Id: 2
Type: Volume Fader
Value: 50557
Line Information:
Name: C
Component Type: Source Compact Disc
Line Id: 0
Num Of Controls: 2
Name: M
Control Id: 3
Control Flag: 1
Type: Mute Switch
Value: 0
Name: V
Control Id: 4
Control Flag: 1
Type: Volume Fader
Value: 50557
Name: M
Component Type: Source Wave Out
Line Id: 65536
Num Of Controls: 2
Name: M
Control Id: 5
Control Flag: 1
Type: Mute Switch
Value: 0
Name: V
Control Id: 6
Control Flag: 1
Type: Volume Fader
Value: 50557
Mixer device 1 details ...
Name: M
Line Id: 4294901760
Component Type: Destination Speakers
Num of Controls: 2
Control Information:
Name: M
Control Id: 1
Type: Mute Switch
Value: 0
Name: V
Control Id: 2
Type: Volume Fader
Value: 65535
Line Information:
Name: C
Component Type: Source Compact Disc
Line Id: 0
Num Of Controls: 2
Name: M
Control Id: 3
Control Flag: 1
Type: Mute Switch
Value: 0
Name: V
Control Id: 4
Control Flag: 1
Type: Volume Fader
Value: 65535
Name: M
Component Type: Source Wave Out
Line Id: 65536
Num Of Controls: 2
Name: M
Control Id: 5
Control Flag: 1
Type: Mute Switch
Value: 0
Name: V
Control Id: 6
Control Flag: 1
Type: Volume Fader
Value: 65535
Mixer device 2 details ...
Name: M
Line Id: 4294901760
Component Type: Destination Wave In
Num of Controls: 2
Control Information:
Name: M
Control Id: 1
Type: Mute Switch
Value: 0
Name: V
Control Id: 2
Type: Volume Fader
Value: 65535
Line Information:
Name: M
Component Type: Source Line
Line Id: 0
Num Of Controls: 2
Name: M
Control Id: 3
Control Flag: 1
Type: Mute Switch
Value: 0
Name: V
Control Id: 4
Control Flag: 1
Type: Volume Fader
Value: 65535
Mixer device 3 details ...
Name: M
Line Id: 4294901760
Component Type: Destination Wave In
Num of Controls: 2
Control Information:
Name: M
Control Id: 1
Type: Mute Switch
Value: 0
Name: V
Control Id: 2
Type: Volume Fader
Value: 54707
Line Information:
Name: M
Component Type: Source Microphone
Line Id: 0
Num Of Controls: 2
Name: M
Control Id: 3
Control Flag: 1
Type: Mute Switch
Value: 0
Name: V
Control Id: 4
Control Flag: 1
Type: Volume Fader
Value: 54707
Mixer device 4 details ...
Name: M
Line Id: 4294901760
Component Type: Destination Wave In
Num of Controls: 2
Control Information:
Name: M
Control Id: 1
Type: Mute Switch
Value: 0
Name: V
Control Id: 2
Type: Volume Fader
Value: 41942
Line Information:
Name: M
Component Type: Source Microphone
Line Id: 0
Num Of Controls: 2
Name: M
Control Id: 3
Control Flag: 1
Type: Mute Switch
Value: 0
Name: V
Control Id: 4
Control Flag: 1
Type: Volume Fader
Value: 41942



Regards,
Vish







Re: Vista Pro-Audio Application Development Using legacy waveXxx functions in Vista

chris319

I have a small audio application originally developed on XP which uses the waveXxx functions. I am feeding this program a 1 kHz sine wave generated by another computer via the line input (a MacBook running Vista under Boot Camp). The sine wave has been set to -10 dBV by actual measurement with a true RMS voltmeter. I was getting truly bizarre behavior from the volume control depending on which application I used (Control Panel -> Sound -> Recording -> Line In -> Levels). With Goldwave, the sine wave was clipping (I suspect Goldwave uses DirectSound). With my application, the samples were only coming up to just above 16384 (half amplitude) even if I set the level slider to 100. Try as I might, I could not get the levels to come up to 32767. This was never a problem under XP. Then I clicked the "Enhancements" tab and noticed that none of the five check boxes was checked. I checked "Disable All Enhancements" and all of a sudden the volume control started behaving normally on my waveXxx program, as it did under XP. I then clicked on "Restore Defaults". The "Disable All Enhancements" box became unchecked and the problems I was originally having resurfaced (sine wave not coming up to full amplitude). I rechecked "Disable All Enhancements" and the program started behaving normally again. Now both Goldwave and my program share the same level settings with consistent levels.

The volume control and ensuing amplitude of audio samples definitely behave strangely when there is no box checked on this panel. By explicity checking "Disable All Enhancements" the problem disappears. It would seem that there is no need for the "Disable All Enhancements" checkbox (if none of the four enhancement boxes is checked then all enhancements have been disabled) but the strange behavior of audio levels needs to be investigated when none of the five boxes is checked.

I hope this information helps track down what I believe is a bug in Vista audio.





Re: Vista Pro-Audio Application Development Using legacy waveXxx functions in Vista

andygg

I have exactly the same question (new thread started 17 Oct 2007 "Muting the Input Monitor"). The mixer can only see the endpoint volume and the cd and waveout mixerlines. I printed out the dwComponentType and they were

MIXERLINE_COMPONENTTYPE_SRC_COMPACTDISC

and

MIXERLINE_COMPONENTTYPE_SRC_WAVEOUT

repectively, which isn't what we want.

I tried using the IDeviceTopology interface, using a slight modification of the MSDN sample code, changing the flow direction so I could walk through the render devices (the sample is for capture devices). I got each IPart interface and printed out the names and there is a "Master Mute", which is the endpoint mute, then something called "mute". You can get an IControlInterface for the mute control and use it to mute the part called "mute", but if you have more than one mute control, they all seem to be called "mute", and there is no way, that I can see, to tell whether a particular control is the Input Monitor (sidetone).






Re: Vista Pro-Audio Application Development Using legacy waveXxx functions in Vista

andygg

woops, wrong thread, sorry.