case SPEEX_GET_BITRATE: speex_encoder_ctl(st->st_low, request, ptr); (*(int*)ptr) += SUBMODE(bitrate); break;
void sb_encoder_ctl(void *state, int request, void *ptr){   SBEncState *st;   st=state;   switch(request)   {   case SPEEX_GET_FRAME_SIZE:      (*(int*)ptr) = st->full_frame_size;      break;   case SPEEX_SET_HIGH_MODE:      st->submodeID = (*(int*)ptr);      break;   case SPEEX_SET_LOW_MODE:      speex_encoder_ctl(st->st_low, SPEEX_SET_MODE, ptr);      break;   case SPEEX_SET_VBR:      speex_encoder_ctl(st->st_low, SPEEX_SET_VBR, ptr);      break;   case SPEEX_SET_VBR_QUALITY:      {         int qual = (*(int*)ptr)+1;         if (qual>10)            qual=10;         speex_encoder_ctl(st->st_low, SPEEX_SET_VBR_QUALITY, &qual);         speex_encoder_ctl(state, SPEEX_SET_QUALITY, ptr);         break;      }   case SPEEX_SET_QUALITY:      {         int nb_mode;         int quality = (*(int*)ptr);         switch (quality)         {         case 0:            nb_mode=1;            st->submodeID = 1;            break;         case 1:            nb_mode=2;            st->submodeID = 1;            break;         case 2:            nb_mode=3;            st->submodeID = 1;            break;         case 3:            nb_mode=4;            st->submodeID = 1;            break;         case 4:            nb_mode=4;            st->submodeID = 2;            break;         case 5:            nb_mode=5;            st->submodeID = 2;            break;         case 6:         case 7:            nb_mode=6;            st->submodeID = 2;            break;         case 8:         case 9:         case 10:            nb_mode=6;            st->submodeID = 3;            break;         default:            fprintf(stderr, "Unknown sb_ctl quality: %d\n", quality);         }         speex_encoder_ctl(st->st_low, SPEEX_SET_MODE, &nb_mode);      }      break;   case SPEEX_SET_COMPLEXITY:      speex_encoder_ctl(st->st_low, SPEEX_SET_COMPLEXITY, ptr);      st->complexity = (*(int*)ptr);      break;   case SPEEX_GET_COMPLEXITY:      (*(int*)ptr) = st->complexity;      break;   default:      fprintf(stderr, "Unknown nb_ctl request: %d\n", request);   }}