Ejemplo n.º 1
0
void LinearShiftAmplitude::doCommand(int flag)
{
    BR_Envelope envelope(GetSelectedEnvelope(NULL));
    if (envelope.CountSelected() < 2)
        return;

    double amt = (envelope.LaneMaxValue() - envelope.LaneMinValue()) / 100 * m_dAmount;

    double p0; envelope.GetPoint(envelope.GetSelected(0), &p0, NULL, NULL, NULL);
    double pN; envelope.GetPoint(envelope.GetSelected(envelope.CountSelected()-1), &pN, NULL, NULL, NULL);
    if (p0 == pN)
        return; // same point in time

    double m = amt / (pN - p0);
    double b;

    if (m_bReverse)
        m *= -1.0;
    if (m_bReverse)
        b = amt - m *p0;
    else
        b = -m * p0;

    for (int i = 0; i < envelope.CountSelected(); ++i)
    {
        double position, value;
        envelope.GetPoint(envelope.GetSelected(i), &position, &value, NULL, NULL);

        value = SetToBounds(value + position * m + b, envelope.LaneMinValue(), envelope.LaneMaxValue());
        envelope.SetPoint(envelope.GetSelected(i), NULL, &value, NULL, NULL);
    }
    envelope.Commit();
}
Ejemplo n.º 2
0
    /* center of bounding box centroid */
    void label_position2(double *x, double *y) const
    {

        box2d<double> box = envelope();
        *x = box.center().x;
        *y = box.center().y; 
    }
Ejemplo n.º 3
0
  virtual void process(YSE::SOUND_STATUS & intent) {
    YSE::DSP::ADSRenvelope::STATE state = YSE::DSP::ADSRenvelope::RESUME;

    if (intent == YSE::SS_WANTSTOPLAY) {
      state = YSE::DSP::ADSRenvelope::ATTACK;
      intent = YSE::SS_PLAYING;
      releaseRequested = false;
    }
    else if (intent == YSE::SS_WANTSTOSTOP && !releaseRequested) {
      state = YSE::DSP::ADSRenvelope::RELEASE;
      releaseRequested = true;
    }

    
    out = generator(getFrequency());
    out *= envelope(state);
    out *= 0.25f;
    
    if (envelope.isAtEnd()) intent = YSE::SS_STOPPED;

    for (UInt i = 0; i < buffer.size(); i++) {
      buffer[i] = out;
    }
    
  }
int playback_callback (snd_pcm_sframes_t nframes) {

    int l1, l2;
    double dphi, freq_note, sound;

    memset(buf, 0, nframes * 4);
    for (l2 = 0; l2 < POLY; l2++) {
        if (note_active[l2]) {
            freq_note = (note[l2]*FREQ_CHANNEL_WIDTH)+FREQ_START;
/*debug	    printf(" Note Frequency %6.2f \n", freq_note); */

/* make faster by precompute delta phase*/
            dphi = (M_PI * freq_note * 2) / (rate);
/*debug            printf(" detaphase %6.6f ", dphi);*/
	    for (l1 = 0; l1 < nframes; l1++) {
                phi[l2] += dphi;
/* make faster by precompute 2pi */
                if (phi[l2] > 2.0 * M_PI) {
			phi[l2] -= 2.0 * M_PI;
		}
/* NEED faster OPTION THAN SIN (phi) */
/* maybe series expantion? */
/* maybe lookup tables? */
                sound = GAIN * sin(phi[l2])* envelope(&note_active[l2], gate[l2], &env_level[l2], env_time[l2], attack, decay, sustain, release);
                env_time[l2] += 1.0 / rate;
                buf[2 * l1] += sound;
                buf[2 * l1 + 1] += sound;
            }
        }
    }
    return snd_pcm_writei (playback_handle, buf, nframes);
}
Ejemplo n.º 5
0
/**
 * It shall be impossible to change the pointer as long as an Accessor is in use.
 * specification: removeItemWait() will fail with a "timeoutException" if
 * the envelope remains locked for a period longer than the predefined 
 * "maxWaitingTime".
 */
void ptrEnvelopeTest::testTimeoutIn_removeItemWait() {

  PtrEnvelope envelope(5); // we set the maxWaitingTime time to 5 milliseconds to speed up the test.
  //PtrEnvelope envelope; // the default waiting time of half a second (be patient when testing)
  portCount = 0;

  unique_ptr<Port > port = unique_ptr<Port > (new PortMock(newPortId++));
  envelope.setItemWait(move(port));
  CPPUNIT_ASSERT(envelope.hasItem());

  std::thread readAccessTread([&]{accessAndHoldPointer(envelope, true);});
  std::this_thread::sleep_for(std::chrono::milliseconds(5)); // make sure the thread has started

  bool timeoutDetected = false;
  bool unexpectedException = false;
  try {
    // provoke a timeout (the readAccessTread holds blocks the Accessor for more than maxWaitingTime) 
    envelope.removeItemWait();
  } catch (TimeoutException& ex) {
    timeoutDetected = true;
    std::cerr << "Timeout detected:" << ex.what() << std::endl;
  } catch (...) {
    unexpectedException = true;
  }
  readAccessTread.join();
  CPPUNIT_ASSERT(timeoutDetected);
  CPPUNIT_ASSERT(!unexpectedException);

  // verify that the envelope still holds the port
  CPPUNIT_ASSERT_EQUAL(1, portCount);
  CPPUNIT_ASSERT(envelope.hasItem());

}
Ejemplo n.º 6
0
std::unique_ptr<te::rst::Raster> terrama2::core::cloneRaster(const te::rst::Raster& raster)
{
  std::vector<te::rst::BandProperty*> bands;
  for(size_t i = 0; i < raster.getNumberOfBands(); ++i)
  {
    bands.push_back(new te::rst::BandProperty(*raster.getBand(i)->getProperty()));
  }
  std::unique_ptr<te::gm::Envelope> envelope(new te::gm::Envelope(*raster.getExtent()));
  std::unique_ptr<te::rst::Grid> grid(new te::rst::Grid(raster.getNumberOfColumns(), raster.getNumberOfRows(), envelope.release(), raster.getSRID()));
  std::unique_ptr<te::rst::Raster> expansible(te::rst::RasterFactory::make("EXPANSIBLE", grid.release(), bands, {}));

  for(uint bandIdx = 0; bandIdx < raster.getNumberOfBands(); ++bandIdx)
  {
    const te::rst::Band* rasterBand = raster.getBand(bandIdx);
    te::rst::Band* expansibleBand = expansible->getBand(bandIdx);

    const int nblocksX = rasterBand->getProperty()->m_nblocksx;
    const int nblocksY = rasterBand->getProperty()->m_nblocksy;
    int blkYIdx = 0;

    for( int blkXIdx = 0 ; blkXIdx < nblocksX ; ++blkXIdx )
    {
      for( blkYIdx = 0 ; blkYIdx < nblocksY ; ++blkYIdx )
      {
        std::unique_ptr<unsigned char[]> buffer(new unsigned char[rasterBand->getBlockSize()]);
        rasterBand->read( blkXIdx, blkYIdx, buffer.get());
        expansibleBand->write( blkXIdx, blkYIdx, buffer.get());
      }
    }
  }

  return expansible;
}
Ejemplo n.º 7
0
int envelope_(const int *numsamp,const double *f,double *fenv)

{

  return envelope(*numsamp,f,fenv);

}
Ejemplo n.º 8
0
CRectangleElement::CRectangleElement(double xMin, double yMin, double xMax, double yMax)
{
	m_enumElementType = ET_FILL_RECTANGLE_ELEMENT;
	GEOMETRY::geom::Envelope envelope(xMin,xMax, yMin, yMax );
	m_pGeometry = GEOMETRY::geom::GeometryFactory::getDefaultInstance()->toGeometry(&envelope);
	m_pSelectionHandle.reset(new CEnvelopeTracker(*m_pGeometry->getEnvelopeInternal(), HT_EIGHT));
}
Ejemplo n.º 9
0
void LimiterMono<N>::process(float* input, int16_t* output, int numFrames) {

    for (int n = 0; n < numFrames; n++) {

        // peak detect and convert to log2 domain
        int32_t peak = peaklog2(&input[n]);

        // compute limiter attenuation
        int32_t attn = MAX(_threshold - peak, 0);

        // apply envelope
        attn = envelope(attn);

        // convert from log2 domain
        attn = fixexp2(attn);

        // lowpass filter
        attn = _filter.process(attn);
        float gain = attn * _outGain;

        // delay audio
        float x = input[n];
        _delay.process(x);

        // apply gain
        x *= gain;

        // apply dither
        x += dither();

        // store 16-bit output
        output[n] = (int16_t)floatToInt(x);
    }
}
Ejemplo n.º 10
0
int playback_callback (snd_pcm_sframes_t nframes) {

    int l1, l2;
    double dphi, dphi_mod, f1, f2, f3, freq_note, sound;
      
    memset(buf, 0, nframes * 4);
    for (l2 = 0; l2 < POLY; l2++) {
        if (note_active[l2]) {
            f1 = 8.176 * exp((double)(transpose+note[l2]-2)*log(2.0)/12.0);
            f2 = 8.176 * exp((double)(transpose+note[l2])*log(2.0)/12.0);
            f3 = 8.176 * exp((double)(transpose+note[l2]+2)*log(2.0)/12.0);
            freq_note = (pitch > 0) ? f2 + (f3-f2)*pitch : f2 + (f2-f1)*pitch;
            dphi = M_PI * freq_note / 22050.0;                                    
            dphi_mod = dphi * (double)harmonic / (double)subharmonic;
            for (l1 = 0; l1 < nframes; l1++) {
                phi[l2] += dphi;
                phi_mod[l2] += dphi_mod;
                if (phi[l2] > 2.0 * M_PI) phi[l2] -= 2.0 * M_PI;
                if (phi_mod[l2] > 2.0 * M_PI) phi_mod[l2] -= 2.0 * M_PI;
                sound = GAIN * envelope(&note_active[l2], gate[l2], &env_level[l2], env_time[l2], attack, decay, sustain, release)
                             * velocity[l2] * sin(phi[l2] + modulation * sin(phi_mod[l2]));
                env_time[l2] += 1.0 / 44100.0;
                buf[2 * l1] += sound;
                buf[2 * l1 + 1] += sound;
            }
        }    
    }
    return snd_pcm_writei (playback_handle, buf, nframes); 
}
Ejemplo n.º 11
0
void Concrete01WithSITC::getSITCslope ()
{
  double tempStrain = Tstrain;
  double tempStress = Tstress;
  Tstrain = CminStrain;
  envelope();
  TslopeSITC = Tstress/(CminStrain-CendStrainSITC);
  Tstrain = tempStrain;
  Tstress = tempStress;
}
Ejemplo n.º 12
0
Envelope::AutoPtr
GeometryCollection::computeEnvelopeInternal() const
{
	Envelope::AutoPtr envelope(new Envelope());
	for (size_t i=0; i<geometries->size(); i++) {
		const Envelope *env=(*geometries)[i]->getEnvelopeInternal();
		envelope->expandToInclude(env);
	}
	return envelope;
}
Ejemplo n.º 13
0
/* public static */
std::unique_ptr<Node>
Node::createNode(const Envelope& env)
{
	Key key(env);
	std::unique_ptr<Envelope> envelope(new Envelope(key.getEnvelope()));
	std::unique_ptr<Node> node (
		new Node(std::move(envelope), key.getLevel())
	);
	return std::move(node);
}
Ejemplo n.º 14
0
static void all(FILE *fp, struct fetchinfo *fi,
	struct imapscaninfo *i, unsigned long msgnum,
	struct rfc2045 *mimep)
{
	doflags(fp, fi, i, msgnum, mimep);
	writes(" ");
	internaldate(fp, fi, i, msgnum, mimep);
	writes(" ");
	rfc822size(fp, fi, i, msgnum, mimep);
	writes(" ");
	envelope(fp, fi, i, msgnum, mimep);
}
Ejemplo n.º 15
0
// DEBUG
void
Email::dump()
{
    debug(" --- Email ---");
    debug("uid           : " + to_string(uid())          );
    debug("rfc822_size   : " + to_string(rfc822_size())  );
    debug("friendly_time : " + friendly_time());
    debug("internaldate  : " + internaldate() );
//     debug("flags         : " + flags()        );
    bitset<8> bin(em_flags);
    cout << "flags: " << bin << endl;
    envelope().dump();
}
Ejemplo n.º 16
0
void CMSEmulator::portWrite(int port, int val) {
	switch (port) {
	case 0x220:
		portWriteIntern(0, 1, val);
		break;

	case 0x221:
		_saa1099[0].selected_reg = val & 0x1f;
		if (_saa1099[0].selected_reg == 0x18 || _saa1099[0].selected_reg == 0x19) {
			/* clock the envelope channels */
			if (_saa1099[0].env_clock[0])
				envelope(0, 0);
			if (_saa1099[0].env_clock[1])
				envelope(0, 1);
		}
		break;

	case 0x222:
		portWriteIntern(1, 1, val);
		break;

	case 0x223:
		_saa1099[1].selected_reg = val & 0x1f;
		if (_saa1099[1].selected_reg == 0x18 || _saa1099[1].selected_reg == 0x19) {
			/* clock the envelope channels */
			if (_saa1099[1].env_clock[0])
				envelope(1, 0);
			if (_saa1099[1].env_clock[1])
				envelope(1, 1);
		}
		break;

	default:
		warning("CMSEmulator got port: 0x%X", port);
		break;
	}
}
Ejemplo n.º 17
0
void process(struct dt_iop_module_t *self, dt_dev_pixelpipe_iop_t *piece, const void *const i, void *const o,
             const dt_iop_roi_t *const roi_in, const dt_iop_roi_t *const roi_out)
{
  dt_iop_monochrome_data_t *d = (dt_iop_monochrome_data_t *)piece->data;
  const float sigma2 = (d->size * 128.0) * (d->size * 128.0f);
// first pass: evaluate color filter:
#ifdef _OPENMP
#pragma omp parallel for default(none) shared(d) schedule(static)
#endif
  for(int k = 0; k < roi_out->height; k++)
  {
    const float *in = ((float *)i) + (size_t)4 * k * roi_out->width;
    float *out = ((float *)o) + (size_t)4 * k * roi_out->width;
    for(int j = 0; j < roi_out->width; j++, in += 4, out += 4)
    {
      out[0] = 100.0f * color_filter(in[1], in[2], d->a, d->b, sigma2);
      out[1] = out[2] = 0.0f;
      out[3] = in[3];
    }
  }

  // second step: blur filter contribution:
  const float scale = piece->iscale / roi_in->scale;
  const float sigma_r = 250.0f; // does not depend on scale
  const float sigma_s = 20.0f / scale;
  const float detail = -1.0f; // bilateral base layer

  dt_bilateral_t *b = dt_bilateral_init(roi_in->width, roi_in->height, sigma_s, sigma_r);
  dt_bilateral_splat(b, (float *)o);
  dt_bilateral_blur(b);
  dt_bilateral_slice(b, (float *)o, (float *)o, detail);
  dt_bilateral_free(b);

#ifdef _OPENMP
#pragma omp parallel for default(none) shared(d) schedule(static)
#endif
  for(int k = 0; k < roi_out->height; k++)
  {
    const float *in = ((float *)i) + (size_t)4 * k * roi_out->width;
    float *out = ((float *)o) + (size_t)4 * k * roi_out->width;
    for(int j = 0; j < roi_out->width; j++, in += 4, out += 4)
    {
      const float tt = envelope(in[0]);
      const float t = tt + (1.0f - tt) * (1.0f - d->highlights);
      out[0] = (1.0f - t) * in[0]
               + t * out[0] * (1.0f / 100.0f) * in[0]; // normalized filter * input brightness
    }
  }
}
astro::project::ImageEnvelope	convert(const ImageInfo& info) {
    astro::project::ImageEnvelope	envelope(info.id);
    envelope.uuid(info.uuid);
    envelope.filename(info.filename);
    envelope.project(info.project);
    envelope.created(converttime(info.createdago));
    envelope.camera(info.instrument);
    envelope.size(convert(info.size));
    envelope.binning(convert(info.binning));
    envelope.exposuretime(info.exposuretime);
    envelope.temperature(info.temperature);
    envelope.purpose(astro::camera::Exposure::string2purpose(info.purpose));
    envelope.observation(converttime(info.observationago));
    return envelope;
}
Ejemplo n.º 19
0
void writeStream(PaStream *handle, float frequency, float duration, float amplitude) {
  int i,j,dur, count = 0;
  dur = duration*44100/256;
  float index, index2, control, cr, *buf, *wave;
  cr = 44100/256;
  index = 0.f;
  buf = (float*) malloc(256*sizeof(float));
  wave = sine_table(2048, 0);
  for(j = 0;j < dur;j++){
    oscillator(buf, frequency+oscillator(&control,5.f,5.f, wave, &index2,2048, 1,cr),envelope(duration,cr,&count)*amplitude,wave,&index,2048,256,44100);
    Pa_WriteStream(handle, buf, 256);
  }
  free(buf);
  free(wave);
}
Ejemplo n.º 20
0
void MotionController::record(Controllable &objControllable, float index)
{
	std::map<int, std::map<int, Envelope, ltu_int>, ltu_int>::iterator controllers_i;
	std::map<int, Envelope, ltu_int>::iterator motions_i;
	
	for (controllers_i = controllers.begin(); controllers_i != controllers.end(); controllers_i++)
	{
		for (motions_i = (*controllers_i).second.begin(); motions_i != (*controllers_i).second.end(); motions_i++)
		{
			EnvelopeKey *e;
			e = envelope((*controllers_i).first, (*motions_i).first).addKey(index,objControllable.read_control((*controllers_i).first, (*motions_i).first));
			e->shape = ENV_SHAPE_LINE;
		}
	}
};
Ejemplo n.º 21
0
Box3D PeriodicitySwitch3D::getPeriodicEnvelope(Box3D const& bulk, plint envelopeWidth) const {
    Box3D envelope(bulk);
    if (get(0)) { // If periodic in x, extend bulk in x-direction
        envelope.x0 -= envelopeWidth;
        envelope.x1 += envelopeWidth;
    }
    if (get(1)) { // If periodic in y, extend bulk in y-direction
        envelope.y0 -= envelopeWidth;
        envelope.y1 += envelopeWidth;
    }
    if (get(2)) { // If periodic in y, extend bulk in y-direction
        envelope.z0 -= envelopeWidth;
        envelope.z1 += envelopeWidth;
    }
    return envelope;
}
Ejemplo n.º 22
0
void LimiterQuad<N>::process(float* input, int16_t* output, int numFrames) {

    for (int n = 0; n < numFrames; n++) {

        // peak detect and convert to log2 domain
        int32_t peak = peaklog2(&input[4*n+0], &input[4*n+1], &input[4*n+2], &input[4*n+3]);

        // compute limiter attenuation
        int32_t attn = MAX(_threshold - peak, 0);

        // apply envelope
        attn = envelope(attn);

        // convert from log2 domain
        attn = fixexp2(attn);

        // lowpass filter
        attn = _filter.process(attn);
        float gain = attn * _outGain;

        // delay audio
        float x0 = input[4*n+0];
        float x1 = input[4*n+1];
        float x2 = input[4*n+2];
        float x3 = input[4*n+3];
        _delay.process(x0, x1, x2, x3);

        // apply gain
        x0 *= gain;
        x1 *= gain;
        x2 *= gain;
        x3 *= gain;

        // apply dither
        float d = dither();
        x0 += d;
        x1 += d;
        x2 += d;
        x3 += d;

        // store 16-bit output
        output[4*n+0] = (int16_t)floatToInt(x0);
        output[4*n+1] = (int16_t)floatToInt(x1);
        output[4*n+2] = (int16_t)floatToInt(x2);
        output[4*n+3] = (int16_t)floatToInt(x3);
    }
}
Ejemplo n.º 23
0
std::pair<mapnik::datasource_ptr,mapnik::feature_ptr> fetch_first_feature(std::string const& filename, bool cache_features)
{
    mapnik::parameters params;
    params["type"] = "geojson";
    params["file"] = filename;
    params["cache_features"] = cache_features;
    auto ds = mapnik::datasource_cache::instance().create(params);
    CHECK(ds->type() == mapnik::datasource::datasource_t::Vector);
    auto fields = ds->get_descriptor().get_descriptors();
    mapnik::query query(ds->envelope());
    for (auto const& field : fields)
    {
        query.add_property_name(field.get_name());
    }
    auto features = ds->features(query);
    auto feature = features->next();
    return std::make_pair(ds,feature);
}
Ejemplo n.º 24
0
double EnvelopeGenerator::operator()(double mz) {
  if (last_mz_ > mz)
    throw std::runtime_error("input to EnvelopeGenerator must be sorted");

  if (mz > p_.masses[peak_index_] + width_ * sigma_)
    empty_space_ = true;  // the last peak's influence is now considered negligible

  if (empty_space_ && peak_index_ + 1 < p_.size() &&
      mz >= p_.masses[peak_index_ + 1] - width_ * sigma_) {
    empty_space_ = false;
    ++peak_index_;  // reached next peak

    sigma_ = calculateSigmaAt(p_.masses[peak_index_], instrument_);
  }

  last_mz_ = mz;
  return envelope(mz);
}
Ejemplo n.º 25
0
void TimeCompressExpandPoints::doCommand(int flag)
{
    BR_Envelope envelope(GetSelectedEnvelope(NULL));
    if (envelope.CountSelected() < 2)
        return;

    double firstPointTime;
    envelope.GetPoint(envelope.GetSelected(0), &firstPointTime, NULL, NULL, NULL);
    for (int i = 1; i < envelope.CountSelected(); ++i)
    {
        double position;
        envelope.GetPoint(envelope.GetSelected(i), &position, NULL, NULL, NULL);
        position += (position - firstPointTime) * m_dAmount;
        envelope.SetPoint(envelope.GetSelected(i), &position, NULL, NULL, NULL);
    }

    envelope.Commit();
}
Ejemplo n.º 26
0
std::unique_ptr<te::rst::Raster> terrama2::core::multiplyRaster(const te::rst::Raster& raster, const double& multiplier)
{
  std::vector<te::rst::BandProperty*> bands;
  for(size_t i = 0; i < raster.getNumberOfBands(); ++i)
  {
    te::rst::BandProperty* bProp = new te::rst::BandProperty(*raster.getBand(i)->getProperty());

    bProp->m_type = te::dt::DOUBLE_TYPE;

    bands.push_back(bProp);
  }

  std::unique_ptr<te::gm::Envelope> envelope(new te::gm::Envelope(*raster.getExtent()));
  std::unique_ptr<te::rst::Grid> grid(new te::rst::Grid(raster.getNumberOfColumns(), raster.getNumberOfRows(), envelope.release(), raster.getSRID()));
  std::unique_ptr<te::rst::Raster> expansible(te::rst::RasterFactory::make("EXPANSIBLE", grid.release(), bands, {}));

  uint32_t columns = raster.getNumberOfColumns();
  uint32_t rows = raster.getNumberOfRows();

  for(uint bandIdx = 0; bandIdx < raster.getNumberOfBands(); ++bandIdx)
  {
    const te::rst::Band* rasterBand = raster.getBand(bandIdx);
    const auto bandProperty = rasterBand->getProperty();
    auto noData = bandProperty->m_noDataValue;
    te::rst::Band* expansibleBand = expansible->getBand(bandIdx);

    for(uint32_t col = 0 ; col < columns ; col++)
    {
      for(uint32_t row = 0 ; row < rows ; row++)
      {
        double value = 0.0;
        rasterBand->getValue(col, row, value);
        if(value != noData)
          expansibleBand->setValue(col, row, value * multiplier);
        else
          expansibleBand->setValue(col, row, noData);
      }
    }
  }

  return expansible;
}
Ejemplo n.º 27
0
unsigned char PulseWave::tick()
{
  float prd = period();
  float phase = fmod(((time - (0.125 * prd)) / prd), 1.0);
  if (phase < 0.0) {
    phase += 1.0;
  }
  float out = (phase < duty) ? envelope() : 0.0;
  if ((divider < PULSE_MINIMUM_DIVIDER) || (divider > PULSE_MAXIMUM_DIVIDER)) {
    out = 0;
  }
  if (!enabled) {
    out = 0;
  }
  if (!lengthCounterValue) {
    out = 0;
  }
  time += 1.0 / sampleRate;
  return out;
}
Ejemplo n.º 28
0
//! @brief ??
void XC::Concrete01::reload(void)
  {
    if(trialState.getStrain() <= trialHistory.MinStrain())
      {
        trialHistory.MinStrain()= trialState.getStrain();
        // Determine point on envelope
        envelope();
        unload();
      }
    else if(trialState.getStrain() <= trialHistory.EndStrain())
      {
        trialState.Tangent()= trialHistory.getUnloadSlope();
        trialState.Stress()= trialState.getTangent()*(trialState.getStrain()-trialHistory.EndStrain());
      }
    else
      {
        trialState.Stress()= 0.0;
        trialState.Tangent()= 0.0;
      }
  }
Ejemplo n.º 29
0
void Concrete01WithSITC::reload ()
{

  if (Tstrain <= TminStrain) {
    
    TminStrain = Tstrain;
    // Determine point on envelope
    envelope ();
    
    unload ();
  }
  else if (Tstrain <= TendStrain) {
    Ttangent = TunloadSlope;
    Tstress = Ttangent*(Tstrain-TendStrain);
  }
  else {
    Tstress = 0.0;
    Ttangent = 0.0;
  }
  
}
Ejemplo n.º 30
0
void AddToEnvPoints::doCommand(int flag)
{
    BR_Envelope envelope(GetSelectedEnvelope(NULL));
    if (!envelope.CountSelected())
        return;
    double cursorPos = GetCursorPosition();

    if( m_pp == POINTTIME)
	{
		double beat = (240.0 / TimeMap2_GetDividedBpmAtTime(0, cursorPos));
		double amount = beat * m_dAmount;

		for (int i = 0; i < envelope.CountSelected(); ++i)
		{
			int id = envelope.GetSelected(i);
			double position;
			envelope.GetPoint(id, &position, NULL, NULL, NULL);
			position += amount;
			envelope.SetPoint(id, &position, NULL, NULL, NULL);
		}
	}
	else
	{
		double amount = (envelope.LaneMaxValue() - envelope.LaneMinValue()) / 100 * m_dAmount;

		for (int i = 0; i < envelope.CountSelected(); ++i)
		{
			int id = envelope.GetSelected(i);
			double value;
			envelope.GetPoint(id, NULL, &value, NULL, NULL);
			value += amount;
			SetToBounds(value, envelope.LaneMinValue(), envelope.LaneMaxValue());
			envelope.SetPoint(id, NULL, &value, NULL, NULL);
		}
	}
	envelope.Commit();
}