Ejemplo n.º 1
0
double OSM_cSizeDist::percentPassing( double size )
{
    double retVal = 0.0;
    int i, N = nSize();
    OSM_Vector& sVec = sieve();

    if (N>0 && size>=sVec[0])
      retVal = cDist[0]; //assume data for largest size

    for( i=0; i<(N-1); i++ )
    {
        if( sVec[i] == size )
        {
            retVal = cDist[i];
            break;
        }
        else if( sVec[i] > size && sVec[i+1] < size )
        {
            setRR( sVec[i], sVec[i+1], cDist[i], cDist[i+1] );
            retVal = percentRR( size );
            break;
        }
    }
    return retVal;
}
Ejemplo n.º 2
0
static void packRTCP_rr(t_packRTCP *x, t_symbol*s, int argc, t_atom*argv) {
  iemrtp_rtcp_changetype(&x->x_rtcp, RTCP_RR);

  if(argc>1) {
    t_symbol*s1=atom_getsymbol(argv);
    if(SELECTOR_RTCP_RR_SSRC==s1) {
      x->x_rtcp.r.rr.ssrc=GETUINT32(argc-1, argv+1);
    } else if(A_FLOAT==argv->a_type) { // 'RR <id> <VALhi> <VALlo>'
      int index;
      if(argc<3) {
        pd_error(x, "usage: %s <#> <type> <VALhi> <VALlo> ...", s->s_name);
        return;
      }
      index=atom_getint(argv);
      if(iemrtp_rtcp_ensureRR(&x->x_rtcp, index+1) && setRR(x->x_rtcp.r.rr.rr+index, argc-1, argv+1)) {
      } else {
        pd_error(x, "unable to set %s/RR @ %d", s->s_name, index);
        return;
      }
    } else {
      pd_error(x, "invalid field-id '%s'", s->s_name);
      return;
    }
    return;
  }
  pd_error(x, "syntax: %s <field> <VALhi> <VALlo>", s->s_name);
}
Ejemplo n.º 3
0
double OSM_cSizeDist::sizePassing( double percent )
{
    double retVal = 0.0;
    int i, N = nSize();
    OSM_Vector& sVec = sieve();

    for( i=0; i<(N-1); i++ )
    {
        if( cDist[i] == percent )
        {
            retVal = sVec[i];
            break;
        }
        else if( cDist[i]>percent && cDist[i+1]<percent )
        {
            setRR( sVec[i], sVec[i+1], cDist[i], cDist[i+1] );
            retVal = sizeRR( percent );
            break;
        }
    }
    return retVal;
}
Ejemplo n.º 4
0
static void packRTCP_sr(t_packRTCP *x, t_symbol*s, int argc, t_atom*argv) {
  iemrtp_rtcp_changetype(&x->x_rtcp, RTCP_SR);

  if(argc>1) {
    t_symbol*s1=atom_getsymbol(argv);
    if(SELECTOR_RTCP_SR_SSRC==s1) {
      x->x_rtcp.r.sr.ssrc=GETUINT32(argc-1, argv+1);
    } else if(SELECTOR_RTCP_SR_NTP  == s1) {
      if(argc<5) {
        pd_error(x, "usage: %s %s <SEChi> <SEClo> <FRAChi> <FRAClo>", s->s_name, s1->s_name);
        return;
      }
      x->x_rtcp.r.sr.ntp_sec =GETUINT32(2, argv+1);
      x->x_rtcp.r.sr.ntp_frac=GETUINT32(2, argv+3);
    } else if(SELECTOR_RTCP_SR_TS   == s1) {
      x->x_rtcp.r.sr.rtp_ts=GETUINT32(argc-1, argv+1);
    } else if(SELECTOR_RTCP_SR_PSENT== s1) {
      x->x_rtcp.r.sr.psent=GETUINT32(argc-1, argv+1);
    } else if(SELECTOR_RTCP_SR_OSENT== s1) {
      x->x_rtcp.r.sr.osent=GETUINT32(argc-1, argv+1);
    } else if(A_FLOAT==argv->a_type) { // 'SR <id> <VALhi> <VALlo>'
      int index=atom_getint(argv);
      if(argc<3) {
        pd_error(x, "usage: %s <#> <type> <VALhi> <VALlo>...", s->s_name);
        return;
      }
      if(iemrtp_rtcp_ensureSR(&x->x_rtcp, index+1) && setRR(x->x_rtcp.r.sr.rr+index, argc-1, argv+1)) {
      } else {
        pd_error(x, "unable to set %s/RR @ %d", s->s_name, index);
        return;
      }
    } else {
      pd_error(x, "invalid field-id '%s'/'%s'", s->s_name, s1->s_name);
      return;
    }
    return;
  }
  pd_error(x, "syntax: %s <field> <VALhi> <VALlo>", s->s_name);
}