case SPEEX_GET_RELATIVE_QUALITY: (*(float*)ptr)=st->relative_quality; break;
void 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->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_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)            st->submodeID = 0;         else if (quality<=1)            st->submodeID = 1;         else if (quality<=2)            st->submodeID = 2;         else if (quality<=4)            st->submodeID = 3;         else if (quality<=6)            st->submodeID = 4;         else if (quality<=8)            st->submodeID = 5;         else if (quality<=9)            st->submodeID = 6;         else if (quality<=10)            st->submodeID = 7;         else         fprintf(stderr, "Unknown nb_ctl quality: %d\n", quality);*/         if (quality < 0)            quality = 0;         if (quality > 10)            quality = 10;         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>=1)         {            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_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;   default:      fprintf(stderr, "Unknown nb_ctl request: %d\n", request);   }}