SB AWE32 Developer's Information Pack
PART II DOS Real/Protected Mode API
••
30
Copyright
Creative Technology Ltd., 1994-1996
Version 3.00
sp.bank_no = 0;
// Load into bank 0
sp.data = buffer;
// Packet buffer
if ( awe32SFontLoadRequest(&sp) ) {
// Error, invalid SoundFont bank
}
// To stream sound sample
if ( sp.no_sample_packets > 0 ) {
fseek(fp, sp.sample_seek, SEEK_SET);
for (i=0; i<sp.no_sample_packets; i++) {
fread(buffer, 1, PACKETSIZE, fp);
awe32StreamSample(&sp);
}
}
// To load presets
sp.presets = (char *) malloc(sp.preset_read_size);
fseek(fp, sp.preset_seek, SEEK_SET);
fread(sp.presets, 1, sp.preset_read_size, fp);
if ( awe32SetPresets(&sp) ) {
// Error, invalid SoundFont bank
}
if ( awe32InitMIDI() ) {
// Error, MIDI engine initialization failed
}
It is recommended that synthesizer SoundFont bank such as SYNTHGM.SBK loads as Bank 0.
Loading wave data as an instrument
The steps are similar to those of loading a SoundFont bank except that WAVE_PACKET functions are
used.
#include “ctaweapi.h”
int i;
FILE *fp;
LONG banks[2];
WAVE_PACKET wp;
SOUND_PACKET sp;
char buffer[PACKETSIZE];
// Embed GM presets
awe32SoundPad.SPad1 = awe32SPad1Obj;
awe32SoundPad.SPad2 = awe32SPad2Obj;
awe32SoundPad.SPad3 = awe32SPad3Obj;
awe32SoundPad.SPad4 = awe32SPad4Obj;
awe32SoundPad.SPad5 = awe32SPad5Obj;
awe32SoundPad.SPad6 = awe32SPad6Obj;
awe32SoundPad.SPad7 = awe32SPad7Obj;
// Determine available patch DRAM
awe32TotalPatchRam(&sp);
if ( sp.total_patch_ram < 512*1024 ) {
// Error, not enough patch DRAM
}
// Setup bank sizes
banks[0] = 0;
// Embeded GM presets
banks[1] = sp.total_patch_ram;
// Use all available ram,
sp.banksizes = banks;
// could be less
sp.total_banks = 2;
// Total no. of banks
if ( awe32DefineBankSizes(&sp) ) {
// Error, invalid sizes
}