DirectX SDK |
This section gives a practical overview of how the various DirectSound interfaces are used in order to play and capture sound. The following topics are discussed:
Note Most of the examples of method calls throughout this section are given in the C language form, which accesses methods by means of a pointer to a table of pointers to functions, and requires a this pointer as the first parameter in any call. For example, a C call to the IDirectSound::GetCaps method takes this form:
lpDirectSound->lpVtbl->GetCaps(lpDirectSound, &dscaps);
The same method call in the C++ form, which treats COM interface methods just like class methods, looks like this:
lpDirectSound->GetCaps(&dscaps);
Dsound.h contains macros that expand to either the C or C++ form of the method call, depending on the environment. These macros simplify the C calls and also make it possible to develop routines that can be used in either language. For example:
IDirectSound_GetCaps(lpDirectSound, &dscaps);
[C++,Visual Basic]