static ngx_int_t queue_remove (max_connections_peer_data_t *peer_data) { max_connections_srv_conf_t *maxconn_cf = peer_data->maxconn_cf; /* return 0 if it wasn't in the queue */ if(peer_data->queue.next == NULL) return 0; max_connections_peer_data_t *oldest = queue_oldest (maxconn_cf); ngx_queue_remove(&peer_data->queue); peer_data->queue.prev = peer_data->queue.next = NULL; maxconn_cf->queue_length -= 1; assert(maxconn_cf->queue_length == queue_size(peer_data->maxconn_cf)); ngx_log_error( NGX_LOG_INFO , peer_data->r->connection->log , 0 , "max_connections del queue (new size %ui)" , maxconn_cf->queue_length ); if(ngx_queue_empty(&maxconn_cf->waiting_requests)) { /* delete the timer if the queue is empty now */ if(maxconn_cf->queue_check_event.timer_set) { ngx_del_timer( (&maxconn_cf->queue_check_event) ); } } else if(oldest == peer_data) { /* if the removed peer_data was the first */ /* make sure that the check queue timer is set when we have things in * the queue */ oldest = queue_oldest (maxconn_cf); /* ------|-----------|-------------|------------------------ */ /* accessed now accessed + TIMEOUT */ ngx_add_timer( (&maxconn_cf->queue_check_event) , RAMP(oldest->accessed + maxconn_cf->queue_timeout - ngx_current_msec) ); } return 1; }
#include <math.h> #include <string.h> #include "wahwah.h" #include "codec.h" #include "utils.h" #include "waveshaper.h" void processWahwah(const FloatAudioBuffer* restrict in, FloatAudioBuffer* restrict out, WahwahState* state, const WahwahParams* params) { // Set centre wah bandpass frequency to 200..800 Hz const float wah = RAMP(params->wah, HZ2OMEGA(200), HZ2OMEGA(800)); // Set bandpass Q to 1..32, on an exponential scale const float q = exp2f(RAMP(params->q, 0.0f, 5.0f)); FloatBiquadCoeffs coeffs; bqMakeBandpass(&coeffs, wah, q); bqProcess(in, out, &coeffs, &state->bqstate); } void initWahwah(WahwahState* state) { memset(state, 0, sizeof(*state)); }