SB AWE32 Developer's Information Pack
PART III Windows Driver API
••
76
Copyright
Creative Technology Ltd., 1994-1996
Version 3.00
InitApplication(hInst);
hWnd = CreateWindow("DEMO", "AWE Application", WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
NULL, NULL, hInst, NULL);
.
.
/* Check for number of devices available in the system */
/* System which does not support multiple card (like Win3.1) will */
/* simply return 1 if there is an AWE hardware. */
lResult = AWEManager(0,AWE_GET_NUM_DEVS,(LPARAM)(WORD FAR *)&num,0);
if (lResult != AWE_NO_ERR)
{
/* Do error processing here! */
.
.
return NULL;
}
/* Open the AWE Manager and retrieve a registered ID. */
/* The 0 in last parameter refers to the first device available in */
/* the system. The value in this parameter should never be greater */
/* or equals to num */
lResult = AWEManager((AWEHANDLE)0, AWE_OPEN, (LPARAM)&hDeviceID,
0);
if(lResult != AWE_NO_ERR)
{
/* Do error processing here! */
.
.
return NULL;
}
.
.
/* Acquire & dispatch messages until a WM_QUIT msg is received */
while (GetMessage(&msg,NULL,NULL,NULL))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
/* Close AWE Manager */
AWEManager(hDeviceID, AWE_CLOSE, 0L, 0L);
return (msg.wParam);
}
If the calling application is running on a system that supports multiple AWE hardware (like Windows
95), it should use the AWE_GET_NUM_DEVS API to determine the number of devices available in the
system. If there is a need to selectively pick from one of the devices, the application can use the
AWE_GET_DEVICE_CAPS API to retrieve capabilities of individual AWE devices.
Remember to close the AWE Manager by calling AWE_CLOSE as shown in the example above. This
will allow other applications to use the manager after you have finished using it.
Querying for supports
The query class API provided by the Manager allows you to query the AWE's current available
resources. It is important to query for available support before issuing them. This is because, the features
provided by the Manager may increase or changes as time goes past. Generally, the options available of
querying are Synthesizer Bank, Effect Types and Type Variations. In addition, the memory available on
the AWE can also be queried.
The following function retrieves the available support and updates the global variables. This example
can be added in your program's initialization routine.