Q: I'm using an ADS product with an AC97 audio codec. I know the AC97 has capabilities not directly exposed by Microsoft's waveXXXX functions for things like volume, gain and tone control. How do I adjust those settings on my system?
While ADS does not supply a specific library for directly affecting individual characteristics of the AC97, our audio driver does support generic commands for reading and writing the AC97 registers through the waveInMessage and waveOutMessage APIs, which gives you the ability to affect these capabilities.
Below is a quick example of how you can use these in your application:
// ----------------------------------------------------------------------------
// NOTE: For all waveInMessage and waveOutMessage calls to directly affect
// the AC97, use this format:
// waveXXXMessage(hwi, {command}, {register}, {data});
//
// See your codec's data sheet for valid value ranges for
// the data for your register of interest.
// custom AC97 commands
#define WPDM_WRITE_AC97 0 // do a write to the ac 97 register
#define WPDM_READ_AC97 1 // do a read to the ac 97 register
// AC97 registers
#define MASTER_VOLUME 0X02 // LINE OUT VOLUME
#define HEADPHONE_VOLUME 0X04
#define MASTER_VOLUME_MONO 0X06
#define MASTER_TONE_R_L 0X08
#define PC_BEEP_VOLUME 0X0A
#define PHONE_VOLUME 0X0C
#define MIC_VOLUME 0X0E // MICROPHONE VOLUME/ AGC
#define LINE_IN_VOLUME 0X10 // LINE IN VOLUME
#define CD_VOLUME 0X12
#define VIDEO_VOLUME 0X14
#define AUX_VOLUME 0X16
#define PCM_OUT_VOL 0X18
#define RECORD_SELECT 0X1A // SELECT LINE IN OR MICROPHONE
#define RECORD_GAIN 0X1C
#define RECORD_GAIN_MIC 0X1E //undefined for UCB1400
// sample for adjusting the microphone volume
// assumes you've already opened the wave device
waveInMessage(hwi, WPDM_WRITE_AC97, MIC_VOLUME, newVolume);
// ----------------------------------------------------------------------------