void AL_Update( void ) { int i; channel_t *ch; vec_t orientation[6]; paintedtime = cl.time; // set listener parameters qalListener3f( AL_POSITION, AL_UnpackVector( listener_origin ) ); AL_CopyVector( listener_forward, orientation ); AL_CopyVector( listener_up, orientation + 3 ); qalListenerfv( AL_ORIENTATION, orientation ); qalListenerf( AL_GAIN, s_volume->value ); qalDistanceModel( AL_LINEAR_DISTANCE_CLAMPED ); // update spatialization for dynamic sounds ch = channels; for( i = 0; i < s_numchannels; i++, ch++ ) { if( !ch->sfx ) continue; if( ch->autosound ) { // autosounds are regenerated fresh each frame if( ch->autoframe != s_framecount ) { AL_StopChannel( ch ); continue; } } else { ALenum state; qalGetError(); qalGetSourcei( ch->srcnum, AL_SOURCE_STATE, &state ); if( qalGetError() != AL_NO_ERROR || state == AL_STOPPED ) { AL_StopChannel( ch ); continue; } } if (s_show->value) { Com_Printf ("%3i %s\n", ch->master_vol, ch->sfx->name); } AL_Spatialize(ch); // respatialize channel } s_framecount++; // add loopsounds AL_AddLoopSounds (); // add music OGG_Stream(); S_AL_StreamUpdate(); AL_IssuePlaysounds(); }
/* ================= S_AL_Update ================= */ static void S_AL_Update( void ) { int i; // Update SFX channels S_AL_SrcUpdate(); // Update streams for (i = 0; i < MAX_RAW_STREAMS; i++) S_AL_StreamUpdate(i); S_AL_MusicUpdate(); // Doppler if(s_doppler->modified) { s_alDopplerFactor->modified = qtrue; s_doppler->modified = qfalse; } // Doppler parameters if(s_alDopplerFactor->modified) { if(s_doppler->integer) qalDopplerFactor(s_alDopplerFactor->value); else qalDopplerFactor(0.0f); s_alDopplerFactor->modified = qfalse; } if(s_alDopplerSpeed->modified) { qalDopplerVelocity(s_alDopplerSpeed->value); s_alDopplerSpeed->modified = qfalse; } // Clear the modified flags on the other cvars s_alGain->modified = qfalse; s_volume->modified = qfalse; s_musicVolume->modified = qfalse; s_alMinDistance->modified = qfalse; s_alRolloff->modified = qfalse; }