[wdmaudiodev] Re: sample rate control on Vista

  • From: "Dugan Porter" <duganp@xxxxxxxxxxxxxxxxxxxxx>
  • To: <wdmaudiodev@xxxxxxxxxxxxx>
  • Date: Mon, 17 Jul 2006 16:40:06 -0700

Hi Nikolay.  Here's a multi-part answer for you:

1. There is no programmatic way for an app to set the mmsys.cpl capture rate, 
because the Vista philosophy is that no audio app can make configuration 
changes that affect any other apps.  The setting in mmsys.cpl is only meant to 
be changed by the user.

2. If an app uses the legacy APIs (waveIn and DirectSoundCapture) to capture 
audio at a rate other than mmsys.cpl's, the system will convert from the 
mmsys.cpl rate to the app's requested rate using a sample rate converter.

3. However, if an app uses the new WASAPI API in exclusive mode (by using the 
AUDCLNT_SHAREMODE_EXCLUSIVE flag), it can open the device in any format 
supported by the driver, and no SRC will be used.  The downside is that no 
other app will be able capture audio.

4. If you need to use a legacy API, you can at least *discover* the system 
capture rate setting using the new Vista APIs, and then capture at that rate, 
to avoid the SRC; however this doesn't let you *control* the rate.

Hope that helps -
Dugan Porter - Game Audio Team - Microsoft
This posting is provided "as is" with no warranties, and confers no rights
 

-----Original Message-----
From: wdmaudiodev-bounce@xxxxxxxxxxxxx 
[mailto:wdmaudiodev-bounce@xxxxxxxxxxxxx] On Behalf Of Nikolay V. Pyatkov
Sent: Sunday, July 16, 2006 3:22 PM
To: wdmaudiodev@xxxxxxxxxxxxx
Subject: [wdmaudiodev] sample rate control on Vista

Hi,

We have an input only WDM portcls audio driver on Vista 5456. The driver can 
support 48,000 and 44,100 sample rate. The application needs to open this 
driver at 48,000. Here is the code:

WAVEFORMATEX wf;
wf.wFormatTag      = WAVE_FORMAT_PCM;
wf.nChannels       =  2;
wf.nSamplesPerSec  = 48000;
wf.nAvgBytesPerSec = 192000;
wf.nBlockAlign     = nBlockAlign;
wf.wBitsPerSample  = UCODEC_BIT_PER_SAMPLE_PCM;
wf.cbSize          = 0;

mmResult = waveInOpen(
        &m_hWaveIn, 
        nInputDeviceId,
        &m_WaveFormat,
        (DWORD_PTR)m_hWaveInEvent,
        0,
         CALLBACK_EVENT);

mmResult is 0.

But the trace in the driver shows:

00000431        9.63108540      ValidatePcm :   
00000432        9.63109016      ---- cbSize         = 22        
00000433        9.63109398      ---- nChannels      = 2 
00000434        9.63109875      ---- nSamplesPerSec = 44100     
00000435        9.63110352      ---- wBitsPerSample = 16        

The Vista audio subsystem took the parameters from "Audio 
Devices->Recording->My Device->Properties->Options" .If I manually modify 
value in the Options panel Vista will use the value to open my device.

I tried to check/uncheck "exclusive control" box. Does not help. How do I get 
control over the bit rate back to the application? 

Thanks,
Nikolay








******************

WDMAUDIODEV addresses:
Post message: mailto:wdmaudiodev@xxxxxxxxxxxxx
Subscribe:    mailto:wdmaudiodev-request@xxxxxxxxxxxxx?subject=subscribe
Unsubscribe:  mailto:wdmaudiodev-request@xxxxxxxxxxxxx?subject=unsubscribe
Moderator:    mailto:wdmaudiodev-moderators@xxxxxxxxxxxxx

URL to WDMAUDIODEV page:
http://www.wdmaudiodev.com/


******************

WDMAUDIODEV addresses:
Post message: mailto:wdmaudiodev@xxxxxxxxxxxxx
Subscribe:    mailto:wdmaudiodev-request@xxxxxxxxxxxxx?subject=subscribe
Unsubscribe:  mailto:wdmaudiodev-request@xxxxxxxxxxxxx?subject=unsubscribe
Moderator:    mailto:wdmaudiodev-moderators@xxxxxxxxxxxxx

URL to WDMAUDIODEV page:
http://www.wdmaudiodev.com/

Other related posts: