engine/source/gamelib/soundmix.c
// Find and initialize SoundBlaster, allocate memory, initialize tables...
Find and initialize SoundBlaster, allocate memory, initialize tables
Find and initialize SoundBlaster allocate memory initialize tables
int sound_init(int channels)
{
    int i;
    if(channels < 2)
    {
        channels = 2;
    }
    if(channels > MAX_CHANNELS)
    {
        channels = MAX_CHANNELS;
    }
    sound_exit();
    if((mixbuf = malloc(MIXBUF_SIZE)) == NULL)
    {
#ifdef PSP
        SB_exit();
#endif
        return 0;
    }
    max_channels = channels;
    for(i = 0; i < max_channels; i++)
    {
        memset(&vchannel[i], 0, sizeof(channelstruct));
    }
    mixing_active = 0;
    mixing_inited = 1;
    List_Init(&samplelist);
    return 1;
}
int sound_init ( int channels ) { int i ; if ( channels < 2 ) { channels = 2 ; } if ( channels > MAX_CHANNELS ) { channels = MAX_CHANNELS ; } sound_exit ( ) ; if ( ( mixbuf = malloc ( MIXBUF_SIZE ) ) == NULL ) { #ifdef PSP SB_exit ( ) ; #endif return 0 ; } max_channels = channels ; for ( i = 0 ; i < max_channels ; i ++ ) { memset ( & vchannel [ i ] , 0 , sizeof ( channelstruct ) ) ; } mixing_active = 0 ; mixing_inited = 1 ; List_Init ( & samplelist ) ; return 1 ; }
Find and initialize SoundBlaster, allocate memory, initialize tables...
Find and initialize SoundBlaster allocate memory initialize tables ...
// Allocate the maximum amount ever possibly needed for mixing