Search by Tags

Read and Write AC97 Codec Registers


Article updated at 28 Oct 2017
Compare with Revision

It is possible to read and write any registers of the codec chip assembled on the Colibri by using the Windows CE API waveOutMessage(). Of course, the wave driver has to be loaded.
Return value of waveOutMessage():

  • 0 = Success
  • not 0 = Error

C source code sample

#include <windows.h>
// message definition:
#define WPDM_PRIVATE WM_USER+10      
#define WPDM_PRIVATE_WRITE_AC97      WPDM_PRIVATE+0 // do a write to the ac 97 register
#define WPDM_PRIVATE_READ_AC97       WPDM_PRIVATE+1 // do a read to the ac 97 register 
DWORD RegAddr = x;
DWORD RegVal  = y;
//Write a register:
if(waveOutMessage(0, WPDM_PRIVATE_WRITE_AC97, RegAddr, RegVal) != 0)
	   return FALSE; // error
//Read a register:
if(waveOutMessage(0, WPDM_PRIVATE_READ_AC97, RegAddr, (DWORD)&RegVal) != 0)
	   return FALSE; // error


If you would like to use the waveOutMessage API in .NET (C#, etc.), you can load this API with a dllimport from the coredll.dll.