void SetParameter(int parameter, int value, int relative) {//====================================================== // parameter: reset-all, amp, pitch, speed, linelength, expression, capitals, number grouping // relative 0=absolute 1=relative int new_value = value; int default_value; if(relative) { if(parameter < 5) { default_value = param_defaults[parameter]; new_value = default_value + (default_value * value)/100; } } param_stack[0].parameter[parameter] = new_value; switch(parameter) { case espeakRATE: embedded_value[EMBED_S] = new_value; embedded_value[EMBED_S2] = new_value; SetSpeed(3); break; case espeakVOLUME: embedded_value[EMBED_A] = new_value; GetAmplitude(); break; case espeakPITCH: if(new_value > 99) new_value = 99; if(new_value < 0) new_value = 0; embedded_value[EMBED_P] = new_value; break; case espeakRANGE: if(new_value > 99) new_value = 99; embedded_value[EMBED_R] = new_value; break; case espeakLINELENGTH: option_linelength = new_value; break; case espeakWORDGAP: option_wordgap = new_value; break; case espeakINTONATION: if((new_value & 0xff) != 0) translator->langopts.intonation_group = new_value & 0xff; option_tone_flags = new_value; break; default: break; } } // end of SetParameter
/** * Base Perlin noise generator - fills height map with raw Perlin noise. * * This runs several iterations with increasing precision; the last iteration looks at areas * of 1 by 1 tiles, the second to last at 2 by 2 tiles and the initial 2**MAX_TGP_FREQUENCIES * by 2**MAX_TGP_FREQUENCIES tiles. */ static void HeightMapGenerate() { /* Trying to apply noise to uninitialized height map */ assert(_height_map.h != NULL); int start = max(MAX_TGP_FREQUENCIES - (int)min(MapLogX(), MapLogY()), 0); bool first = true; for (int frequency = start; frequency < MAX_TGP_FREQUENCIES; frequency++) { const amplitude_t amplitude = GetAmplitude(frequency); /* Ignore zero amplitudes; it means our map isn't height enough for this * amplitude, so ignore it and continue with the next set of amplitude. */ if (amplitude == 0) continue; const int step = 1 << (MAX_TGP_FREQUENCIES - frequency - 1); if (first) { /* This is first round, we need to establish base heights with step = size_min */ for (int y = 0; y <= _height_map.size_y; y += step) { for (int x = 0; x <= _height_map.size_x; x += step) { height_t height = (amplitude > 0) ? RandomHeight(amplitude) : 0; _height_map.height(x, y) = height; } } first = false; continue; } /* It is regular iteration round. * Interpolate height values at odd x, even y tiles */ for (int y = 0; y <= _height_map.size_y; y += 2 * step) { for (int x = 0; x <= _height_map.size_x - 2 * step; x += 2 * step) { height_t h00 = _height_map.height(x + 0 * step, y); height_t h02 = _height_map.height(x + 2 * step, y); height_t h01 = (h00 + h02) / 2; _height_map.height(x + 1 * step, y) = h01; } } /* Interpolate height values at odd y tiles */ for (int y = 0; y <= _height_map.size_y - 2 * step; y += 2 * step) { for (int x = 0; x <= _height_map.size_x; x += step) { height_t h00 = _height_map.height(x, y + 0 * step); height_t h20 = _height_map.height(x, y + 2 * step); height_t h10 = (h00 + h20) / 2; _height_map.height(x, y + 1 * step) = h10; } } /* Add noise for next higher frequency (smaller steps) */ for (int y = 0; y <= _height_map.size_y; y += step) { for (int x = 0; x <= _height_map.size_x; x += step) { _height_map.height(x, y) += RandomHeight(amplitude); } } } }
void TGaussFitAnalysedPulse::Draw(const TH1F* tpi_pulse)const{ if(tpi_pulse) { std::string name=tpi_pulse->GetName(); TF1* tap_pulse=new TF1((name+"_AP").c_str(),functions::gauss_lin,0,1000,5); // parameters: // 0: constant (pedestal) // 1: gradient // 2: Gauss amplitude // 3: Gauss mean // 4: Gauss width tap_pulse->SetParameters(GetPedestal(),fGradient,GetAmplitude(),GetTime(),fWidth); tap_pulse->Draw(); tap_pulse->Write(); } }
static int SinWave() { double omega, tee; unsigned long i; bzero((void *) func, sizeof(short)*TOTAL_POINTS); spts = GetSampClock(); omega = 2.0 * PI * (double) freq; for (i=0; i<TOTAL_POINTS; i++) { tee = (double) i / spts; func[i] = FuncToShort(sin(omega * tee) * GetAmplitude(i)); } return 1; }
void KVQH1::TreateSignal() { if (GetN() == 0) return; if (!TestWidth()) ChangeChannelWidth(GetChannelWidth()); RemoveBaseLine(); if (fWithPoleZeroCorrection) PoleZeroSuppression(fTauRC); FIR_ApplyTrapezoidal(fTrapRiseTime, fTrapFlatTop); ComputeAmplitude(); fAmplitude = GetAmplitude(); SetADCData(); ComputeRiseTime(); fRiseTime = GetRiseTime(); fPSAIsDone = kTRUE; }