SB AWE32 Developer's Information Pack
PART II DOS Real/Protected Mode API
••
31
Copyright
Creative Technology Ltd., 1994-1996
Version 3.00
// Open wave data
fp = fopen(“WAVE.PCM”, “rb”);
// Prepare to load wave data
wp.tag = 0x101;
// Tag
wp.bank_no = 1;
// Load into bank 1
wp.data = buffer;
// Packet buffer
wp.sample_size = 10240;
// 10240 samples
wp.samples_per_sec = 22050;
// 22050 Hz
wp.bits_per_sample = 8;
// 8-bit sample
wp.no_channels = 1;
// Mono sample
wp.looping = 1;
// Looping on
wp.startloop = 0;
// Loop from beginning
wp.endloop = 10240;
// To the end
wp.release = 0;
// Immediate release
if ( awe32WPLoadRequest(&wp) ) {
// Error, cannot use specified wave data
}
// To stream wave data
// See also awe32WPLoadWave
for (i=0; i<wp.no_wave_packets; i++) {
fread(buffer, 1, PACKETSIZE, fp);
awe32WPStreamWave(&wp);
}
// To build SoundFont presets
wp.presets = (char *) malloc(wp.preset_size);
if ( awe32WPBuildSFont(&wp) ) {
// Error, cannot build SoundFont presets
}
if ( awe32InitMIDI() ) {
// Error, MIDI engine initialization failed
}
Using
awe32DefineBankSizes
Beside defining bank sizes, awe32DefineBankSizes can in the following ways:
•
To resize an existing bank. However, the bank to be resized has to be the last bank.
•
To define additional banks. The new banks have to be added beyond the last bank.
Assume that the RAM on the SB AWE32 is divided into 3 banks of 128 kilobytes each.
LONG banks[4]; /* reserve for 4 banks */
SOUND_PACKET sp;
.
.
banks[0] = 128000;
banks[1] = 128000;
banks[2] = 128000;
sp.total_banks = 3;
sp.banksizes = banks;
if ( awe32DefineBankSizes(&sp) ) {
// Error, invalid sizes
}
The last bank can be resized by calling awe32DefineBankSizes.
banks[2] = 150000;
/* new size */
sp.total_banks = 3;
sp.banksizes = banks;
if ( awe32DefineBankSizes(&sp) ) {
// Error, invalid sizes