float *e = (float*)ptr;
spx_sig_t *e = (spx_sig_t*)ptr;
int nb_encoder_ctl(void *state, int request, void *ptr){   EncState *st;   st=(EncState*)state;        switch(request)   {   case SPEEX_GET_FRAME_SIZE:      (*(int*)ptr) = st->frameSize;      break;   case SPEEX_SET_LOW_MODE:   case SPEEX_SET_MODE:      st->submodeSelect = st->submodeID = (*(int*)ptr);      break;   case SPEEX_GET_LOW_MODE:   case SPEEX_GET_MODE:      (*(int*)ptr) = st->submodeID;      break;   case SPEEX_SET_VBR:      st->vbr_enabled = (*(int*)ptr);      break;   case SPEEX_GET_VBR:      (*(int*)ptr) = st->vbr_enabled;      break;   case SPEEX_SET_VAD:      st->vad_enabled = (*(int*)ptr);      break;   case SPEEX_GET_VAD:      (*(int*)ptr) = st->vad_enabled;      break;   case SPEEX_SET_DTX:      st->dtx_enabled = (*(int*)ptr);      break;   case SPEEX_GET_DTX:      (*(int*)ptr) = st->dtx_enabled;      break;   case SPEEX_SET_ABR:      st->abr_enabled = (*(int*)ptr);      st->vbr_enabled = 1;      {         int i=10, rate, target;         float vbr_qual;         target = (*(int*)ptr);         while (i>=0)         {            speex_encoder_ctl(st, SPEEX_SET_QUALITY, &i);            speex_encoder_ctl(st, SPEEX_GET_BITRATE, &rate);            if (rate <= target)               break;            i--;         }         vbr_qual=i;         if (vbr_qual<0)            vbr_qual=0;         speex_encoder_ctl(st, SPEEX_SET_VBR_QUALITY, &vbr_qual);         st->abr_count=0;         st->abr_drift=0;         st->abr_drift2=0;      }            break;   case SPEEX_GET_ABR:      (*(int*)ptr) = st->abr_enabled;      break;   case SPEEX_SET_VBR_QUALITY:      st->vbr_quality = (*(float*)ptr);      break;   case SPEEX_GET_VBR_QUALITY:      (*(float*)ptr) = st->vbr_quality;      break;   case SPEEX_SET_QUALITY:      {         int quality = (*(int*)ptr);         if (quality < 0)            quality = 0;         if (quality > 10)            quality = 10;         st->submodeSelect = st->submodeID = ((SpeexNBMode*)(st->mode->mode))->quality_map[quality];      }      break;   case SPEEX_SET_COMPLEXITY:      st->complexity = (*(int*)ptr);      if (st->complexity<1)         st->complexity=1;      break;   case SPEEX_GET_COMPLEXITY:      (*(int*)ptr) = st->complexity;      break;   case SPEEX_SET_BITRATE:      {         int i=10, rate, target;         target = (*(int*)ptr);         while (i>=0)         {            speex_encoder_ctl(st, SPEEX_SET_QUALITY, &i);            speex_encoder_ctl(st, SPEEX_GET_BITRATE, &rate);            if (rate <= target)               break;            i--;         }      }      break;   case SPEEX_GET_BITRATE:      if (st->submodes[st->submodeID])         (*(int*)ptr) = st->sampling_rate*SUBMODE(bits_per_frame)/st->frameSize;      else         (*(int*)ptr) = st->sampling_rate*(NB_SUBMODE_BITS+1)/st->frameSize;      break;   case SPEEX_SET_SAMPLING_RATE:      st->sampling_rate = (*(int*)ptr);      break;   case SPEEX_GET_SAMPLING_RATE:      (*(int*)ptr)=st->sampling_rate;      break;   case SPEEX_RESET_STATE:      {         int i;         st->bounded_pitch = 1;         st->first = 1;         for (i=0;i<st->lpcSize;i++)            st->lsp[i]=(M_PI*((float)(i+1)))/(st->lpcSize+1);         for (i=0;i<st->lpcSize;i++)            st->mem_sw[i]=st->mem_sw_whole[i]=st->mem_sp[i]=st->mem_exc[i]=0;         for (i=0;i<st->bufSize;i++)            st->excBuf[i]=st->swBuf[i]=st->inBuf[i]=st->exc2Buf[i]=0;      }      break;   case SPEEX_SET_SUBMODE_ENCODING:      st->encode_submode = (*(int*)ptr);      break;   case SPEEX_GET_SUBMODE_ENCODING:      (*(int*)ptr) = st->encode_submode;      break;   case SPEEX_GET_PI_GAIN:      {         int i;         float *g = (float*)ptr;         for (i=0;i<st->nbSubframes;i++)            g[i]=st->pi_gain[i];      }      break;   case SPEEX_GET_EXC:      {         int i;         float *e = (float*)ptr;         for (i=0;i<st->frameSize;i++)            e[i]=st->exc[i];      }      break;   case SPEEX_GET_INNOV:      {         int i;         float *e = (float*)ptr;         for (i=0;i<st->frameSize;i++)            e[i]=st->innov[i];      }      break;   case SPEEX_GET_RELATIVE_QUALITY:      (*(float*)ptr)=st->relative_quality;      break;   default:      speex_warning_int("Unknown nb_ctl request: ", request);      return -1;   }   return 0;}