SB AWE32 Developer's Information Pack
PART II DOS Real/Protected Mode API
••
29
Copyright
Creative Technology Ltd., 1994-1996
Version 3.00
Termination
The SB AWE32 EMU8000 subsystem must be properly terminated when your application wishes to quit.
Failure to do so may render any subsequent playing of FM music inaudible.
if ( awe32Terminate() ) {
// Error, termination failed
}
Using embedded GM presets
General MIDI presets are included in this package, EMBED.OBJ. In order to embed the presets, you
need to initialize the awe32SoundPad structure as shown below :
awe32SoundPad.SPad1 = awe32SPad1Obj;
awe32SoundPad.SPad2 = awe32SPad2Obj;
awe32SoundPad.SPad3 = awe32SPad3Obj;
awe32SoundPad.SPad4 = awe32SPad4Obj;
awe32SoundPad.SPad5 = awe32SPad5Obj;
awe32SoundPad.SPad6 = awe32SPad6Obj;
awe32SoundPad.SPad7 = awe32SPad7Obj;
if ( awe32InitMIDI() ) {
// Error, MIDI engine initialisation failed
}
The awe32SoundPad is of type SOUNDPAD and is defined in MIDIVAR.OBJ, and the
awe32SPadXObj variables are defined in EMBED.OBJ.
awe32SoundPad has to be initialized before calling awe32InitMIDI. The General MIDI presets will be
setup as Bank 0 and uses the ROM samples.
Loading a SoundFont Bank
There are several steps involved. For example, to load a User Bank.
#include “ctaweapi.h”
int i;
FILE *fp;
LONG banks[1];
SOUND_PACKET sp;
char buffer[PACKETSIZE];
// Determine available patch DRAM
awe32TotalPatchRam(&sp);
if ( sp.total_patch_ram < 512*1024 ) {
// Error, not enough patch DRAM
}
// Setup bank sizes
banks[0] = sp.total_patch_ram;
// Use all available ram,
sp.banksizes = banks;
// could be less
sp.total_banks = 1;
// Total no. of banks
if ( awe32DefineBankSizes(&sp) ) {
// Error, invalid sizes
}
// Open SoundFont Bank
fp = fopen(“USER.SBK”, “rb”);
fread(buffer, 1, PACKETSIZE, fp);
// Read SoundFont header
// Prepare to load SoundFont Bank