Exemple #1
0
//------------------------------------------------------------------------------
void WahWah::getParameterDisplay(VstInt32 index, char *text)
{
	// return parameter value as text
	switch (index)
	{
	case kParamGain:
		// input filter gain, dB
		float2string(GainValue, text, kVstMaxParamStrLen);
		break;

	case kParamFc:
		// input filter center frequency, Hz
		float2string(FcValue, text, kVstMaxParamStrLen);
		break;

	case kParamQ:
		// input filter resonance, ratio
		float2string(QValue, text, kVstMaxParamStrLen);
		break;
			
	case kParamRate:
		// input filter resonance, ratio
		float2string(RateValue, text, kVstMaxParamStrLen);
		break;
			
	case kParamDepth:
		// input filter resonance, ratio
		float2string(DepthValue, text, kVstMaxParamStrLen);
		break;
	default :
		*text = '\0';
		break;
	};
}
Exemple #2
0
void Gui::displayMotorsData() {

    std::string v;
    std::string w;

    v = float2string(this->interfacesData->motorsDataReceived.v);
    w = float2string(this->interfacesData->motorsDataReceived.w);

    v = v.append(" m/s");
    w = w.append(" m/s");
    this->motors_linear_velocity->set_text(v);
    this->motors_rot_velocity->set_text(w);
    Cairo::RefPtr<Cairo::Context> cr_red = this->motors_canvas->get_window()->create_cairo_context();
    Cairo::RefPtr<Cairo::Context> cr_white = this->motors_canvas->get_window()->create_cairo_context();
    cr_red->set_line_width(2.0);
    cr_white->set_line_width(2.0);
    cr_red->set_source_rgb(0.0, 0.0, 0.0);
    cr_red->paint();
    cr_white->set_source_rgb(1, 1, 1);
    cr_white->move_to(0, 100);
    cr_white->line_to(200, 100);
    cr_white->move_to(100, 0);
    cr_white->line_to(100, 200);
    cr_red->set_source_rgb(0.8, 0.0, 0.0);
    cr_red->move_to(0, this->previous_event_y);
    cr_red->line_to(200, this->previous_event_y);
    cr_red->move_to(this->previous_event_x, 0);
    cr_red->line_to(this->previous_event_x, 200);
    cr_white->stroke();
    cr_red->stroke();

}
Exemple #3
0
//-----------------------------------------------------------------------------------------
void VstXSynth::getParameterDisplay (VstInt32 index, char* text)
{
	text[0] = 0;
	VstXSynthProgram &prog = programs[curProgram];
	switch (index)
	{
		case kWaveform1:
			if (prog.fWaveform1 < .5)
				vst_strncpy (text, "Sawtooth", kVstMaxParamStrLen);
			else
				vst_strncpy (text, "Pulse", kVstMaxParamStrLen);
			break;

		case kFreq1:		float2string (prog.fFreq1, text, kVstMaxParamStrLen);	break;
		case kVolume1:		float2string (prog.fVolume1, text, kVstMaxParamStrLen);	break;	
		case kWaveform2:	float2string (prog.fWaveform2, text, kVstMaxParamStrLen);	break;
		case kFreq2:		float2string (prog.fFreq2, text, kVstMaxParamStrLen);	break;
		case kVolume2:		float2string (prog.fVolume2, text, kVstMaxParamStrLen);	break;
		case kVolume:		float2string (prog.fVolume, text, kVstMaxParamStrLen);	break;
		case kVowel:		float2string (prog.fVowel, text, kVstMaxParamStrLen);	break;
		case kEnvA:			float2string (prog.fEnvA, text, kVstMaxParamStrLen);	break;
		case kEnvB:			float2string (prog.fEnvB, text, kVstMaxParamStrLen);	break;
		case kEnvLen:		float2string (prog.fEnvLen, text, kVstMaxParamStrLen);	break;
	}
}
Exemple #4
0
/*!
	\param samples Number of samples
	\param text	String up to length char
	\param maxLen Maximal length of the string
*/
void AudioEffect::Hz2string (float samples, char* text, VstInt32 maxLen)
{
	float sampleRate = getSampleRate ();
	if (!samples)
		float2string (0, text, maxLen);
	else
		float2string (sampleRate / samples, text, maxLen);
}
Exemple #5
0
//------------------------------------------------------------------------
// getParameterDisplay()
// for the client to display it
void CSoftExciter::getParameterDisplay (VstInt32 index, char* text)
{
	// helper functions from audioeffect.h
	/*
	dB2string (float value, char* text, VstInt32 maxLen);		///< Stuffs \e text with an amplitude on the [0.0, 1.0] scale converted to its value in decibels.
	Hz2string (float samples, char* text, VstInt32 maxLen);	///< Stuffs \e text with the frequency in Hertz that has a period of \e samples.
	ms2string (float samples, char* text, VstInt32 maxLen);	///< Stuffs \e text with the duration in milliseconds of \e samples frames.
	float2string (float value, char* text, VstInt32 maxLen);	///< Stuffs \e text with a string representation on the floating point \e value.
	int2string (VstInt32 value, char* text, VstInt32 maxLen);	///< Stuffs \e text with a string representation on the integer \e value.
	*/
	if(m_pRAFXPlugIn)
    {
        // they are in VST proper order in the ControlList - do NOT reference them with RackAFX ID values any more!
        CUICtrl* pUICtrl = m_pRAFXPlugIn->m_UIControlList.getAt(index);

        if(pUICtrl)
        {
            // these are the 4 RackAFX datatypes for controls
            // enum {intData, floatData, doubleData, UINTData, nonData};
            switch (pUICtrl->uUserDataType)
            {
                case intData:
					int2string(*pUICtrl->m_pUserCookedIntData, text, kVstMaxParamStrLen);
                    break;

				case floatData:
					float2string(*pUICtrl->m_pUserCookedFloatData, text, kVstMaxParamStrLen);
                    break;

				case doubleData:
					float2string((float)*pUICtrl->m_pUserCookedDoubleData, text, kVstMaxParamStrLen);

                    break;

				case UINTData:
				{
					char* pEnum;
					pEnum = getEnumString(pUICtrl->cEnumeratedList, (int)(*(pUICtrl->m_pUserCookedUINTData)));
					if(pEnum)
						vst_strncpy(text, pEnum, kVstMaxParamStrLen);

					break;
				}
                default:
                    break;
            }
		}
	}
}
Exemple #6
0
/*!
	\param value Value to convert
	\param text	String up to length char
	\param maxLen Maximal length of the string
*/
void AudioEffect::dB2string (float value, char* text, VstInt32 maxLen)
{
	if (value <= 0)
		vst_strncpy (text, "-oo", maxLen);
	else
		float2string ((float)(20. * log10 (value)), text, maxLen);
}
Exemple #7
0
int main(void)
{
    char buf[16];
    char labels[2][16] = {
        "Luftdruck",
        "Windgeschw.",
    };
    char units[2][16] = {
        "Pa",
        "m/s",
    };
    float (*functions[2]) () = {
        barometer_read,
        anemometer_read,
    };

    init();
    while(1)
    {
        lcd_set_battery_level(battery_read());
        float2string(buf, functions[selection]());
        sprintf(buf, "%s %s", buf, units[selection]);
        lcd_set_label(labels[selection], buf);
        lcd_update();
    }
    return 0;
}
Exemple #8
0
//-------------------------------------------------------------
void LowPass::getParameterDisplay(long index, char *text)
{
  switch(index)
  {
    case kcutoff : float2string(cutoff, text); break;
    default: break;
  }
}
Exemple #9
0
//-----------------------------------------------------------------------------------------
void Compressor::getParameterDisplay (VstInt32 index, char* text)
{
	switch (index)
	{
        case kParamInputGain :
            float2string((float)20.0*log10(input_gain), text,kVstMaxParamStrLen);
            break;
        case kParamThreshold :
            float2string((float)logthresh, text,kVstMaxParamStrLen);
            break;
        case kParamAttack:
            float2string((float)1000.0*attack_time, text, kVstMaxParamStrLen);
            break;
        case kParamRelease:
            float2string((float)1000.0*release_time, text, kVstMaxParamStrLen);
            break;
        case kParamRatio:
            float2string((float)comp_ratio, text, kVstMaxParamStrLen);
            break;
        case kParamOutputGain:
            float2string((float)20.0*log10(output_gain), text, kVstMaxParamStrLen);
            break;
        case kParamGRMeter:
            float2string((float)dbgainval, text, kVstMaxParamStrLen);
            break;
        default :
            *text = '\0';
            break;
	};
}
Exemple #10
0
//------------------------------------------------------------------------------
void Reverb::getParameterDisplay (VstInt32 index, char* text)
{
	switch (index)
	{
        case kParamT60low:
            float2string(T60LowValue, text, kVstMaxParamStrLen);
            break;
        case kParamT60high:
            float2string(T60HighValue, text, kVstMaxParamStrLen);
            break;
        case kParamTransition:
            float2string(TransitionValue, text, kVstMaxParamStrLen);
            break;
        case kParamWetDry:
            float2string(100.0*WetDryKnob, text, kVstMaxParamStrLen);
            break;
        case kParamQ:
            float2string(ParametricQValue, text, kVstMaxParamStrLen);
            break;
        case kParamGamma:
            float2string(dB(ParametricGammaValue), text, kVstMaxParamStrLen);
            break;
        case kParamFc:
            float2string(ParametricFcValue, text, kVstMaxParamStrLen);
            break;
        default :
            *text = '\0';
            break;
	};
}
Exemple #11
0
//------------------------------------------------------------------------
void ADelay::getParameterDisplay (VstInt32 index, char *text)
{
	switch (index)
	{
		case kDelay :    int2string (delay, text, kVstMaxParamStrLen);			break;
		case kFeedBack : float2string (fFeedBack, text, kVstMaxParamStrLen);	break;
		case kOut :      dB2string (fOut, text, kVstMaxParamStrLen);			break;
	}
}
//FIXME: the first argument(strPayer) best is Enum type;
std::string ConstructInsertSQLStatement(eActorType ePayer, float fMoney, bool bZYF, bool bHC, bool bDQ,
								  bool bRev1, bool bRev2)
{
	std::string strPayer = ConvertActorType(ePayer);

	std::string baseStr("insert into ConsumeCount(Payer,money,zhangyunfeng,huachen,dongqiang,name_reserve1,name_reserve2,recordTime) values(");
	baseStr = baseStr + "'" + strPayer + "'," + float2string(fMoney) + "," +
		boolean2string(bZYF) + "," + boolean2string(bHC) + "," + boolean2string(bDQ) + "," + boolean2string(bRev1) +"," +
		boolean2string(bRev2) + "," + "(select current_timestamp)" + ")";

	return baseStr;
}
Exemple #13
0
//------------------------------------------------------------------------------
void Distortion::getParameterDisplay(VstInt32 index, char *text)
{
	// return parameter value as text
	switch (index)
	{
        case kParamDrive:
            // input gain, dB
            float2string(DriveValue, text, kVstMaxParamStrLen);
            break;
            
        case kParamLevel:
            // output gain, dB
            float2string(LevelValue, text, kVstMaxParamStrLen);
            break;
            
        case kParamGainIn:
            // input filter gain, dB
            float2string(GainInValue, text, kVstMaxParamStrLen);
            break;
            
        case kParamFcIn:
            // input filter center frequency, Hz
            float2string(FcInValue, text, kVstMaxParamStrLen);
            break;
            
        case kParamQIn:
            // input filter resonance, ratio
            float2string(QInValue, text, kVstMaxParamStrLen);
            break;
            
        case kParamGainOut:
            // output filter gain, dB
            float2string(GainOutValue, text, kVstMaxParamStrLen);
            break;
            
        case kParamFcOut:
            // output filter center frequency, Hz
            float2string(FcOutValue, text, kVstMaxParamStrLen);
            break;
            
        case kParamQOut:
            // output filter resonance, ratio
            float2string(QOutValue, text, kVstMaxParamStrLen);
            break;
            
        default :
            *text = '\0';
            break;
	};
}
// funkcja obliczaj¹ca wartoœæ wysokoœci na podstawie zmierzonego ciœnienia
// oraz podanego QNH. Linijki oznaczone jako "pomiary" s¹ odpowiedzialne za 
// transmisjê tych odczytów przez port szeregowy
float AltiFromPressure(float pressure, int qnh) {
	char temp[10];					// pomiary
	char* endl = ";\n\r";			// pomiary
	float output, powexp;
	powexp = 1/5.255;
	output = 44330 * (1 - pow((pressure / qnh),powexp));
	if (SrlTXing != 1) {					 //// pomiary
	float2string(pressure,temp, 2);			 /// pomiary
	strcpy(temp+7,endl);						 /// pomiary
	FixString(temp,10);					 //// pomiary
	SrlSendData(temp);						 //// pomiary
	}
	return output;
}
//------------------------------------------------------------------------
void ADelay::getParameterDisplay (VstInt32 index, char *text)
{
	switch (index)
	{
		case kDelay :    int2string (delay, text, kVstMaxParamStrLen);			break;
		case kFeedBack : float2string (fFeedBack, text, kVstMaxParamStrLen);	break;
		case kOut :      dB2string (fOut, text, kVstMaxParamStrLen);			break;
		case kTest :      dB2string (fTest, text, kVstMaxParamStrLen);			break;
		case kBass :      dB2string (fBass, text, kVstMaxParamStrLen);			break;
		case kMid :      dB2string (fMid, text, kVstMaxParamStrLen);			break;
		case kTreb :      dB2string (fTreb, text, kVstMaxParamStrLen);			break;
		case kQuantize :      dB2string (fQuant, text, kVstMaxParamStrLen);			break;
		case kFreq :      dB2string (fFreq, text, kVstMaxParamStrLen);			break;
		case kTrunc :      dB2string (fTrunc, text, kVstMaxParamStrLen);			break;
	}
}
Exemple #16
0
//-----------------------------------------------------------------------------------------
void VstXSynth::getParameterDisplay (VstInt32 index, char* text)
{
	text[0] = 0;
	VstXSynthProgram &prog = programs[curProgram];
	switch (index)
	{
		case kWaveform1:
			if (prog.param[kWaveform1] < .5)
				vst_strncpy (text, "Sawtooth", kVstMaxParamStrLen);
			else
				vst_strncpy (text, "Pulse", kVstMaxParamStrLen);
			break;

		default:
			float2string (prog.param[index], text, kVstMaxParamStrLen);	break;
	}
}
Exemple #17
0
void Gui::displayEncodersData() {
    this->encoders_x->set_text(float2string(this->interfacesData->encodersDataReceived->robotx));
    this->encoders_y->set_text(float2string(this->interfacesData->encodersDataReceived->roboty));
    this->encoders_theta->set_text(float2string(this->interfacesData->encodersDataReceived->robottheta));
}
/////////////////////////////////////////////////////////////////////////////
/////   KLAWISZOLOGIA W MENU G£ÓWNYM I POZOSTA£YCH MENU
/////////////////////////////////////////////////////////////////////////////
//  D-pad W LEWO: 	Powrót do poprzedniego menu
//  D-pad W PRAWO:
//  D-pad DO GÓRY:  Poprzednia pozycja menu.. Zmniejszanie wartoœci
//  D-pad W DÓ³:	Nastêpna pozycja menu.. Zwiêkszanie wartoœci
// 	D-pad OK:		Wejœcie do wybranej opcji menu
//////////////////////////////////////////////////////////////////////////////	
void FlightStats(struct FlightData lot) {
	static int menu = 1;			// numer aktualnie wyœwietlanej pozycji w menu
	int menu_change = 0;			// zmienna u¿ywana to przeciwdzia³aniu dr¿eniu przycisków
	int k = 0;
	char temp[10]; 					// pomocnicza tablica charów do wyœwietlania napisaów
	char* nnn = "[[ / ]]";
	HDClearDisp();
	menu_change = 1;				// zmienna blokuj¹ca odœwie¿anie wyœwietlacza gdy nie zmieni³a siê
									// zawartoœæ na nim wyœwietlana. Zapobiega to migotaniu
	HDPrintString(FlightSummaryTitle,1,1);
	while(((GPIOE->IDR & GPIO_IDR_IDR11) == GPIO_IDR_IDR11)) {
		////////////////////////////////////////////////////////////////////////////////////
		// nale¿y zwróciæ uwagê i¿ w tym miejscu nie powinno byæ ¿adnych wywo³añ funkcji  //
		// zmieniaj¹cych zawartosc wyœwietlacza. Z powodu niskiej prêdkoœci pracy wysw.	  //
		// bêdzie widoczne migotanie zawartosci											  //
		//////////////////////////////////////////////////////////////////////////////////// 
		if (menu == 1 && menu_change == 1) {
			// wyœwietlanie pierwszej pozycji
			HDPrintString(nnn,2,5);
			int2string(menu,temp);
			HDPrintString(temp,2,7);
			int2string(FlightStatsC,temp);
			 HDPrintString(temp,2,9);
			float2string(lot.MaxSink, temp,1);
			HDPrintString(MaxDescendingS,3,1);
			HDPrintString(VarioGraphLine,4,1);
			HDPrintString(temp,4,9);
			menu_change = 0;
		}
		else if (menu == 2 && menu_change == 1) {
			// wyœwietlanie drugiej pozycji
			HDPrintString(nnn,2,5);
			int2string(menu,temp);
			HDPrintString(temp,2,7);
			int2string(FlightStatsC,temp);
			HDPrintString(temp,2,9);
			float2string(lot.MaxClimbing, temp,1);
			HDPrintString(MaxClimbingS,3,1);
			HDPrintString(VarioGraphLine,4,1);
			HDPrintString(temp,4,9);
		}
		else if (menu == 3 && menu_change == 1) {
			// wyœwietlanie trzeciej pozycji
			HDPrintString(nnn,2,5);
			int2string(menu,temp);
			HDPrintString(temp,2,7);
			int2string(FlightStatsC,temp);
			HDPrintString(temp,2,9);
			float2string(lot.MaxAltiGain, temp,1);
			HDPrintString(MaxAltGainS,3,1);
			HDPrintString(VarioGraphLine,4,1);
			HDPrintString(temp,4,9);
		}
		else if (menu == 4 && menu_change == 1) {
			// wyœwietlanie czwartej pozycji
			HDPrintString(nnn,2,5);
			int2string(menu,temp);
			HDPrintString(temp,2,7);
			int2string(FlightStatsC,temp);
			HDPrintString(temp,2,9);
			float2string(lot.BestThermalHeigh, temp,1);
			HDPrintString(BestThermalS,3,1);
			HDPrintString(VarioGraphLine,4,1);
			HDPrintString(temp,4,9);
		}
		else if (menu == 5 && menu_change == 1) {
			// wyœwietlanie drugiej pozycji
			HDPrintString(nnn,2,5);
			int2string(menu,temp);
			HDPrintString(temp,2,7);
			int2string(FlightStatsC,temp);
			HDPrintString(temp,2,9);
			int2string(lot.FlightTime, temp);
			HDPrintString(FlightTimeS,3,1);
			HDPrintString(VarioGraphLine,4,1);
			HDPrintString(temp,4,9);
		}
		else if (menu == 6 && menu_change == 1) {
			// wyœwietlanie drugiej pozycji
			HDPrintString(nnn,2,5);
			int2string(menu,temp);
			HDPrintString(temp,2,7);
			int2string(FlightStatsC,temp);
			HDPrintString(temp,2,9);
			float2string(lot.StartAltitude, temp, 2);
			HDPrintString(StartAltiS,3,1);
			HDPrintString(VarioGraphLine,4,1);
			HDPrintString(temp,4,9);
		}
		else if (menu == 7 && menu_change == 1) {
			// wyœwietlanie drugiej pozycji
			HDPrintString(nnn,2,5);
			int2string(menu,temp);
			HDPrintString(temp,2,7);
			int2string(FlightStatsC,temp);
			HDPrintString(temp,2,9);
			float2string(lot.LandingAltitude, temp, 2);
			HDPrintString(LandAltiS,3,1);
			HDPrintString(VarioGraphLine,4,1);
			HDPrintString(temp,4,9);
		}
		else if (menu == 8 && menu_change == 1) {
			// zapisywanie menu... OK potwierdza
			HDPrintString(nnn,2,5);
			int2string(menu,temp);
			HDPrintString(temp,2,7);
			int2string(FlightStatsC,temp);
			HDPrintString(temp,2,9);
			HDPrintString(VarioGraphLine,3,1);
			HDPrintString(SaveFlightS,4,1);
		}
		if(((GPIOE->IDR & GPIO_IDR_IDR9) == 0) && menu <= FlightStatsC && k == 0) {
			// D-PAD w górê.. Przewijanie do nastêpnej pozycji
			menu++;
			k = 1;
			menu_change = 1;
			
		}
		else if(((GPIOE->IDR & GPIO_IDR_IDR10) == 0)&& menu > 0 && k == 0) {
			// D-PAD w dó³... Poprzednia pozycja menu
			menu--;
			k = 1;
			menu_change = 1;
		}
		else if(((GPIOE->IDR & GPIO_IDR_IDR12) == 0)&& menu == 8) {
			// D-PAD OK... Je¿eli wybrano pozycjê 8 to zapis do pamiêci
//			k = 1;
			StoreFlightStatsToFlash(lot);
		}
		else if(((GPIOE->IDR & GPIO_IDR_IDR10) == GPIO_IDR_IDR10) && ((GPIOE->IDR & GPIO_IDR_IDR9) == GPIO_IDR_IDR9) && k == 1) {
			k = 0;
			menu_change = 0;
		}
	}
}
void MainScreen(float vario, float alti, int fltime, int settings) {
	// zmienna settings okresla jakie dane powinny byæ wyœwietlane na ekranie g³ównym
	// jest to zalezne od ustawienia badz nie poszczególnych bitow. Rozpiska znajduje siê poni¿ej
	//
	// bit 0 [LSB] -- Gdy ustawiony wyœwietlanie drugiego wysokoœciomierza zamiast pierwszego
	// bit 1 -- Gdy ustawiony wyœwietlanie wartoœci maksymalnego przewy¿szenia zamiast wysokoœci
	// bit 2 -- Gdy ustawiony wyœwietlanie wartoœci œredniej wariometru zamiast chwilowej
	// bit 3 -- Gdy ustawiony wyœwietlanie maksymalnego wznoszenia zamiast wariometru
	// bit 4 -- Gdy ustawiony wyœwietlanie maksymalnego opadania zamiast wariometru
	// bit 5 -- Gdy ustawiony bargraf wariometru u¿ywa skali logarytmicznej od 0 do 20 ze œrodkiem w 2
	//			Gdy nie ustawiony skala jest liniowa od 0 do 8 ze œrodkiem w 4
	char Main1Line[17];
	char Main2Line[17];
	char Main3Line[17];
//	char Main4Line[16];
	char L1Buff[6];		// Bufor dla wartoœci liczbowych w pierwszej linijsce (domyœlnie czas lotu)
	char L2Buff[9];		// Bufor dla wartoœci liczbowych w drugiej linijsce (domyœlnie wysokoœæ)    )))) 6
	char L3Buff[8];		// Bufor dla wartoœci liczbowych w trzeciej linijsce (domyœlnie wariometr)
//	char* temp = ";\n\r";
	//////////////////////////////////////////////////////////////////////////////////
	/////////////// KLAWISZOLOGIA NA EKRANIE G£ÓWNYM
	//////////////////////////////////////////////////////////////////////////////////
	//  D-Pad W DÓ£: Prze³¹cza wysokoœciomierze. D³u¿sze przytrzymanie resetuje ALTI2
	//  D-Pad W GÓRÊ: Zatrzymuje i startuje odliczanie czasu lotu
	//  D-Pad W LEWO:
	//  D-Pad W PRAWO: Przechodzi do Pamiêci i podsumowania lotów
	//  D-Pad OK: Przechodzi do Menu G³ównego
	//////////////////////////////////////////////////////////////////////////////////  
	if ((settings & 0x1) == 0x1)						// druga linia wyœwietlacza
		strcpy(Main2Line, Alti2Line);
	if ((settings & (0x1 << 1)) == (0x1 << 1))
		strcpy(Main2Line, MaxAltGain);
	if (((settings & 0x1) | (settings & (0x1 << 1))) == 0x0)  
		strcpy(Main2Line, Alti1Line);
	float2string(alti,L2Buff,1);
	if (alti > -1000.0 && alti <= -100.0)
		strcpy(Main2Line+7, L2Buff);
	if (alti > -100.0 && alti <= -10.0)
		strcpy(Main2Line+8, L2Buff);
	if (alti > -10.0 && alti <= 0.0)
		strcpy(Main2Line+9, L2Buff);
	if (alti < 10.0 && alti >= 0.0)
		strcpy(Main2Line+10, L2Buff);
	if (alti >= 10.0 && alti < 100.0)
		strcpy(Main2Line+9, L2Buff);
	if (alti >= 100.0 && alti < 1000.0)
		strcpy(Main2Line+8, L2Buff);
	if (alti >= 1000.0 && alti < 10000.0)
		strcpy(Main2Line+7, L2Buff);
	FixString(Main2Line,16);							// usuwanie niepotrzebnych znaków koñca ci¹gu
	HDPrintString(Main2Line,2,1);						// wysy³anie gotowego wiersza do wyœwietlacza
//	strcpy(ddupa,L2Buff);		
	///////////////////////////////////////////////////////////////////////////////
	if ((settings & (0x1 << 2)) == (0x1 << 2))			// trzecia linijka
		strcpy(Main3Line, VarioAvgLine);
	if ((settings & (0x1 << 3)) == (0x1 << 3))
		strcpy(Main3Line, MaxClimbingLine);
	if ((settings & (0x1 << 4)) == (0x1 << 4))
		strcpy(Main3Line, MaxDescendingLine);
	if (((settings & (0x1 << 2)) | (settings & (0x1 << 3)) | (settings & (0x1 << 4))) == 0x0) {
		strcpy(Main3Line, VarioLine);
		float2string(vario,L3Buff,1);
		if (vario <= -10.0)
			strcpy(Main3Line+6, L3Buff);
		if (vario > -9.9 && vario < 0.0)
			strcpy(Main3Line+7, L3Buff);
		if (vario >= 0.0 && vario < 10.0)
			strcpy(Main3Line+8, L3Buff);
		if (vario >= 10.0)
			strcpy(Main3Line+7, L3Buff);
		FixString(Main3Line,16);
		HDPrintString(Main3Line,3,1);		
	}
	////////////////////////////////////////////////////////////////////////////////
	if (vario != 0) {						 
		if ((settings & (0x1 << 5)) == 0x0) {		// bargraf w czwartej linijce
			if (vario <= -7) 
			 {
				HDPrintString(Bargraph16h,4,9);
				HDPrintString(Bargraph1h,4,1);
				TheMostBeutifulSoundForEveryParagliderPilotOnTheWholeWourldGenerator (1);
			 }
			if (vario > -7 && vario <= -6.5) 
			 {
				HDPrintString(Bargraph16h,4,9);
				HDPrintString(Bargraph2h,4,1);
				TheMostBeutifulSoundForEveryParagliderPilotOnTheWholeWourldGenerator (2);
			 }
			if (vario > -6.5 && vario <= -6) 
			 {
				HDPrintString(Bargraph16h,4,9);
				HDPrintString(Bargraph3h,4,1);
				TheMostBeutifulSoundForEveryParagliderPilotOnTheWholeWourldGenerator (3);
			 }
			if (vario > -6 && vario <= -5.5) 
			 {
				HDPrintString(Bargraph16h,4,9);
				HDPrintString(Bargraph4h,4,1);
				TheMostBeutifulSoundForEveryParagliderPilotOnTheWholeWourldGenerator (4);
			 }
			if (vario > -5.5 && vario <= -5) 
			 {
				HDPrintString(Bargraph16h,4,9);
				HDPrintString(Bargraph5h,4,1);
				TheMostBeutifulSoundForEveryParagliderPilotOnTheWholeWourldGenerator (5);
			 }
			if (vario > -5 && vario <= -4.5) 
			 {
				HDPrintString(Bargraph16h,4,9);
				HDPrintString(Bargraph6h,4,1);
				TheMostBeutifulSoundForEveryParagliderPilotOnTheWholeWourldGenerator (6);
			 }
			if (vario > -4.5 && vario <= -4) 
			 {
				HDPrintString(Bargraph16h,4,9);
				HDPrintString(Bargraph7h,4,1);
				TheMostBeutifulSoundForEveryParagliderPilotOnTheWholeWourldGenerator (7);
			 }
			if (vario > -4 && vario <= -3.5) 
			 {
				HDPrintString(Bargraph16h,4,9);
				HDPrintString(Bargraph8h,4,1);
				TheMostBeutifulSoundForEveryParagliderPilotOnTheWholeWourldGenerator (8);
			 }
			if (vario > -3.5 && vario <= -3) 
			 {
				HDPrintString(Bargraph16h,4,9);
				HDPrintString(Bargraph9h,4,1);
				TheMostBeutifulSoundForEveryParagliderPilotOnTheWholeWourldGenerator (9);
			 }
			if (vario > -3 && vario <= -2.5) 
			 {
				HDPrintString(Bargraph16h,4,9);
				HDPrintString(Bargraph10h,4,1);
				TheMostBeutifulSoundForEveryParagliderPilotOnTheWholeWourldGenerator (10);
			 }
			if (vario > -2.5 && vario <= -2) 
			 {
				HDPrintString(Bargraph16h,4,9);
				HDPrintString(Bargraph11h,4,1);
				TheMostBeutifulSoundForEveryParagliderPilotOnTheWholeWourldGenerator (11);
			 }
			if (vario > -2 && vario <= -1.5) 
			 {
				HDPrintString(Bargraph16h,4,9);
				HDPrintString(Bargraph12h,4,1);
				TheMostBeutifulSoundForEveryParagliderPilotOnTheWholeWourldGenerator (12);
			 }
			if (vario > -1.5 && vario <= -1) 
			 {
				HDPrintString(Bargraph16h,4,9);
				HDPrintString(Bargraph13h,4,1);
				TheMostBeutifulSoundForEveryParagliderPilotOnTheWholeWourldGenerator (13);
			 }
			if (vario > -1 && vario <= -0.5) 
			 {
				HDPrintString(Bargraph16h,4,9);
				HDPrintString(Bargraph14h,4,1);
				TheMostBeutifulSoundForEveryParagliderPilotOnTheWholeWourldGenerator (14);
			 }
			if (vario > -0.5 && vario < 0) 
			 {
				HDPrintString(Bargraph16h,4,9);
				HDPrintString(Bargraph15h,4,1);
				TheMostBeutifulSoundForEveryParagliderPilotOnTheWholeWourldGenerator (15);
			 }
			if (vario > 0 && vario <= 0.5) 
			 {							  	// ZERO
				HDPrintString(Bargraph16h,4,1);
				HDPrintString(Bargraph1h,4,9);
				TheMostBeutifulSoundForEveryParagliderPilotOnTheWholeWourldGenerator (16);
			 }
			if (vario > 0.5 && vario <= 1)
						 {
				HDPrintString(Bargraph16h,4,1);
				HDPrintString(Bargraph2h,4,9);
				TheMostBeutifulSoundForEveryParagliderPilotOnTheWholeWourldGenerator (17);
			 }
			if (vario > 1 && vario <= 1.5)
						 {
				HDPrintString(Bargraph16h,4,1);
				HDPrintString(Bargraph3h,4,9);
				TheMostBeutifulSoundForEveryParagliderPilotOnTheWholeWourldGenerator (18);
			 }
			if (vario > 1.5 && vario <= 2)
						 {
				HDPrintString(Bargraph16h,4,1);
				HDPrintString(Bargraph4h,4,9);
				TheMostBeutifulSoundForEveryParagliderPilotOnTheWholeWourldGenerator (19);
			 }
			if (vario > 2 && vario <= 2.5)
						 {
				HDPrintString(Bargraph16h,4,1);
				HDPrintString(Bargraph5h,4,9);
				TheMostBeutifulSoundForEveryParagliderPilotOnTheWholeWourldGenerator (20);
			 }
			if (vario > 2.5 && vario <= 3)
						 {
				HDPrintString(Bargraph16h,4,1);
				HDPrintString(Bargraph6h,4,9);
				TheMostBeutifulSoundForEveryParagliderPilotOnTheWholeWourldGenerator (21);
			 }
			if (vario > 3 && vario <= 3.5)
						 {
				HDPrintString(Bargraph16h,4,1);
				HDPrintString(Bargraph7h,4,9);
				TheMostBeutifulSoundForEveryParagliderPilotOnTheWholeWourldGenerator (22);
			 }
			if (vario > 3.5 && vario <= 4)
						 {
				HDPrintString(Bargraph16h,4,1);
				HDPrintString(Bargraph8h,4,9);
				TheMostBeutifulSoundForEveryParagliderPilotOnTheWholeWourldGenerator (23);
			 }
			if (vario > 4 && vario <= 4.5)
						 {
				HDPrintString(Bargraph16h,4,1);
				HDPrintString(Bargraph9h,4,9);
				TheMostBeutifulSoundForEveryParagliderPilotOnTheWholeWourldGenerator (24);
			 }
			if (vario > 4.5 && vario <= 5)
						 {
				HDPrintString(Bargraph16h,4,1);
				HDPrintString(Bargraph10h,4,9);
				TheMostBeutifulSoundForEveryParagliderPilotOnTheWholeWourldGenerator (25);
			 }	 
			if (vario > 5 && vario <= 5.5)
						 {
				HDPrintString(Bargraph16h,4,1);
				HDPrintString(Bargraph11h,4,9);
				TheMostBeutifulSoundForEveryParagliderPilotOnTheWholeWourldGenerator (26);
			 }
			if (vario > 5.5 && vario <= 6)
						 {
				HDPrintString(Bargraph16h,4,1);
				HDPrintString(Bargraph12h,4,9);
				TheMostBeutifulSoundForEveryParagliderPilotOnTheWholeWourldGenerator (27);
			 }
			if (vario > 6 && vario <= 6.5)
						 {
				HDPrintString(Bargraph16h,4,1);
				HDPrintString(Bargraph13h,4,9);
				TheMostBeutifulSoundForEveryParagliderPilotOnTheWholeWourldGenerator (28);
			 }
			if (vario > 6.5 && vario <= 7)
						 {
				HDPrintString(Bargraph16h,4,1);
				HDPrintString(Bargraph14h,4,9);
				TheMostBeutifulSoundForEveryParagliderPilotOnTheWholeWourldGenerator (29);
			 }
			if (vario > 7 && vario <= 7.5)
						 {
				HDPrintString(Bargraph16h,4,1);
				HDPrintString(Bargraph15h,4,9);
				TheMostBeutifulSoundForEveryParagliderPilotOnTheWholeWourldGenerator (30);
			 }
			if (vario > 7.5)
						 {
				HDPrintString(Bargraph16h,4,1);
				HDPrintString(Bargraph15h,4,9);
				TheMostBeutifulSoundForEveryParagliderPilotOnTheWholeWourldGenerator (31);
			 }
						
		}
		if ((settings & (0x1 << 5)) != (0x1 << 5)) { 	
			if (vario > 0 && vario <= 0.5);
			if (vario > 0.5 && vario <= 1);
			if (vario > 1 && vario <= 1.5);
			if (vario > 1.5 && vario <= 2);
			if (vario > 2 && vario <= 2.5);
			if (vario > 2.5 && vario <= 3);
			if (vario > 3 && vario <= 3.5);
			if (vario > 3.5 && vario <= 4);
			if (vario > 4 && vario <= 4.5);
			if (vario > 4.5 && vario <= 5);
			if (vario > 5 && vario <= 5.5);
			if (vario > 5.5 && vario <= 6);
			if (vario > 6 && vario <= 6.5);
			if (vario > 6.5 && vario <= 7);
			if (vario > 7 && vario <= 7.5);
			if (vario > 7.5);
		}
	}
	else;	// je¿eli wskazanie wariometru jest równe 0 to bargraf jest pusty
	////////////////////////////////////////////////////////////////////////////////
	strcpy(Main1Line, AirTimeLine);						// pierwsza linijka , zawsze czas
	int2string((int)fltime/2,L1Buff);
	if (((int)fltime/2) < 10)
		strcpy(Main1Line+12, L1Buff);
	if (((int)fltime/2) < 100 && ((int)fltime/2) >= 10)
		strcpy(Main1Line+11, L1Buff);
	if (((int)fltime/2) < 1000 && ((int)fltime/2) >= 100)
		strcpy(Main1Line+10, L1Buff);
	if (((int)fltime/2) < 10000 && ((int)fltime/2) >= 1000)
		strcpy(Main1Line+9, L1Buff);
	FixString(Main1Line,16);
	HDPrintString(Main1Line,1,1);
	////////////////////////////
//	TheMostBeutifulSoundForEveryParagliderPilotOnTheWholeWourldGenerator (j);
	
	
//	SrlSendData((int*)L2Buff);
//////	if (SrlTXing != 1) {
//////	strcpy(L2Buff+6,temp);
//////	FixString(L2Buff,9);
//////	SrlSendData(L2Buff);
//////	}
//   HDPrintString(Bargraph16h,4,1);
//   HDPrintString(Bargraph16h,4,8);
}
Exemple #20
0
void writeFloat(text_t *p, float number)
{
  char str[20];
  char *fs = float2string(number, str, 1, 10);
  writeStr(p, fs);
}
Exemple #21
0
/*!
	\param samples Number of samples
	\param text	String up to length char
	\param maxLen Maximal length of the string
*/
void AudioEffect::ms2string (float samples, char* text, VstInt32 maxLen)
{
	float2string ((float)(samples * 1000. / getSampleRate ()), text, maxLen);
}
Exemple #22
0
void SorolletVSTi::getParameterDisplay(VstInt32 index, char* text)
{
	text[0] = 0;
	switch (index)
	{
		case PARAM_VOLUME1: dB2string(fVolume1, text, kVstMaxParamStrLen);
			break;
		case PARAM_OCTAVE1: int2string(floatToOctave(fOctave1), text, kVstMaxParamStrLen);
			break;
		case PARAM_WAVE1: floatToWaveName(fWave1, text);
			break;
		case PARAM_PHASE1: float2string(fPhase1, text, kVstMaxParamStrLen);
			break;
		case PARAM_VOLUME2: dB2string(fVolume2, text, kVstMaxParamStrLen);
			break;
		case PARAM_OCTAVE2: int2string(floatToOctave(fOctave2), text, kVstMaxParamStrLen);
			break;
		case PARAM_WAVE2: floatToWaveName(fWave2, text);
			break;
		case PARAM_PHASE2: float2string(fPhase2, text, kVstMaxParamStrLen);
			break;
		case PARAM_WAVE_MIX_TYPE: floatToWaveMixTypeName(fWaveMixType, text);
			break;
		case PARAM_NOISE_AMOUNT: float2string(fNoiseAmount, text, kVstMaxParamStrLen);
			break;
		case PARAM_NOISE_MIX_TYPE: floatToNoiseMixTypeName(fNoiseMixType, text);
			break;
		case PARAM_AMP_ATTACK: formatTime(mSorolletVoice->getAmpADSR()->getAttackTime(), text);
			break;
		case PARAM_AMP_DECAY: formatTime(mSorolletVoice->getAmpADSR()->getDecayTime(), text);
			break;
		case PARAM_AMP_SUSTAIN: float2string(fAmpSustain, text, kVstMaxParamStrLen);
			break;
		case PARAM_AMP_RELEASE: formatTime(mSorolletVoice->getAmpADSR()->getReleaseTime(), text);
			break;
		case PARAM_AMP_TIME_SCALE: float2string(floatToEnvelopeScale(fAmpTimeScale), text, kVstMaxParamStrLen);
			break;
		case PARAM_AMP_MIN_VALUE: float2string(mSorolletVoice->getAmpADSR()->getDisplayMinValue(), text, kVstMaxParamStrLen);
			break;
		case PARAM_AMP_MAX_VALUE: float2string(mSorolletVoice->getAmpADSR()->getDisplayMaxValue(), text, kVstMaxParamStrLen);
			break;
		case PARAM_PITCH_ATTACK: formatTime(mSorolletVoice->getPitchADSR()->getAttackTime(), text);
			break;
		case PARAM_PITCH_DECAY: formatTime(mSorolletVoice->getPitchADSR()->getDecayTime(), text);
			break;
		case PARAM_PITCH_SUSTAIN: float2string(fPitchSustain, text, kVstMaxParamStrLen);
			break;
		case PARAM_PITCH_RELEASE: formatTime(mSorolletVoice->getPitchADSR()->getReleaseTime(), text);
			break;
		case PARAM_PITCH_TIME_SCALE: float2string(floatToEnvelopeScale(fPitchTimeScale), text, kVstMaxParamStrLen);
			break;
		case PARAM_PITCH_MIN_VALUE: float2string(mSorolletVoice->getPitchADSR()->getDisplayMinValue(), text, kVstMaxParamStrLen);
			break;
		case PARAM_PITCH_MAX_VALUE: float2string(mSorolletVoice->getPitchADSR()->getDisplayMaxValue(), text, kVstMaxParamStrLen);
			break;
		case PARAM_FILTER_TYPE: floatToFilterTypeName(fFilterType, text);
			break;
		case PARAM_FILTER_FREQUENCY: dB2string(mSorolletVoice->getFilterFrequencyDisplay(), text, kVstMaxParamStrLen);
			break;
		case PARAM_FILTER_RESONANCE: dB2string(mSorolletVoice->getFilterResonanceDisplay(), text, kVstMaxParamStrLen);
			break;
		case PARAM_SATURATE: float2string(fSaturate, text, kVstMaxParamStrLen);
			break;
		case PARAM_EQ_ACTIVE:
			if (fEQActive > 0.5f)
			{
				vst_strncpy(text, "on", kVstMaxParamStrLen);
			}
			else
			{
				vst_strncpy(text, "off", kVstMaxParamStrLen);
			}
			break;
		case PARAM_EQ_LOW_FREQUENCY: float2string(mSorolletVoice->getEQLowFrequencyDisplay(), text, kVstMaxParamStrLen);
			break;
		case PARAM_EQ_HIGH_FREQUENCY: float2string(mSorolletVoice->getEQHighFrequencyDisplay(), text, kVstMaxParamStrLen);
			break;
		case PARAM_EQ_LOW_GAIN: float2string(mSorolletVoice->getEQLowGainDisplay(), text, kVstMaxParamStrLen);
			break;
		case PARAM_EQ_MID_GAIN: float2string(mSorolletVoice->getEQMidGainDisplay(), text, kVstMaxParamStrLen);
			break;
		case PARAM_EQ_HI_GAIN: float2string(mSorolletVoice->getEQHiGainDisplay(), text, kVstMaxParamStrLen);
			break;

	}
}
Exemple #23
0
/*
 * Draw the 3-D box.
 * Input:  it - time step.
 */
void draw_box( Display_Context dtx, int it )
{
    /* base and up vectors for text drawn along x,y,z axes. */
    static float bx[3] = { 0.05, 0.0, 0.0 },      ux[3] = { 0.0, 0.05, 0.05 };
    static float by[3] = { -0.035, 0.0, -0.035 },  uy[3] = { 0.0, 0.07, 0.0 };
    static float bz[3] = { -0.035, -0.035, 0.0 }, uz[3] = { 0.0, 0.0, 0.07 };
    float x1, y1, z1, x2, y2, z2;
    char str[100], xdir1[8], xdir2[8], ydir1[8], ydir2[8];

    /* set depth cueing & line color */
    /* MJK 3.29.99 */
    if (dtx->Reversed) {
        set_color( PACK_COLOR(0,0,0,255) );
    }
    else {
        set_color( dtx->BoxColor );
    }
    /*MiB*/
    xdir1[0] = ' ';
    xdir2[0] = ' ';
    xdir1[1] = '\0';
    xdir2[1] = '\0';
    ydir1[0] = ' ';
    ydir2[0] = ' ';
    ydir1[1] = '\0';
    ydir2[1] = '\0';

    set_depthcue( dtx->DepthCue );

    if(dtx->NumBoxVerts > 0) {
        if (dtx->Reversed) {
            draw_multi_lines( dtx->NumBoxVerts, dtx->BoxVerts, PACK_COLOR(0,0,0,255) );
        }
        else {
            draw_multi_lines( dtx->NumBoxVerts, dtx->BoxVerts, dtx->BoxColor );
        }
    }


    if (dtx->TickMarks) {
        /* Draw axis labels. */
        if (dtx->CoordFlag) {
            x1 = 1.0;
            x2 = (float) dtx->Nc;
            y1 = 1.0;
            y2 = (float) dtx->Nr;
            z1 = 1.0;
            z2 = (float) dtx->MaxNl;
        }
        else {
            x1 = dtx->WestBound;
            x2 = dtx->EastBound;

            y1 = dtx->NorthBound;
            y2 = dtx->SouthBound;

            /*MiB   03/2001 limit range to -180, 180 */
            if (x1 < -180.) {
                x1 = 360. + x1;
            }
            if (x2 < -180.) {
                x2 = 360. + x2;
            }
            if (x1 > 180.) {
                x1 = -360. + x1;
            }
            if (x2 > 180.) {
                x2 = -360. + x2;
            }
            /*MiB   03/2001 Define East/West  */
            if (x1 > 0.) {
                xdir1[0] = 'W';
            } else {
                xdir1[0] = 'E';
                x1 = x1 *(-1.);
            }
            if (x2 > 0.) {
                xdir2[0] = 'W';
            } else {
                xdir2[0] = 'E';
                x2 = x2 *(-1.);
            }
            /*MiB   03/2001 Define North/South  */
            if (y1 > 0.) {
                ydir1[0] = 'N';
            } else {
                ydir1[0] = 'S';
                y1 = y1 *(-1.);
            }
            if (y2 > 0.) {
                ydir2[0] = 'N';
            } else {
                ydir2[0] = 'S';
                y2 = y2 *(-1.);
            }


#ifdef LEVELTYPES
            z1 = dtx->BottomCoordinate;
            z2 = dtx->TopCoordinate;
#else
            z1 = dtx->BottomBound;
            z2 = dtx->TopBound;
#endif
            z1 = VERT(z1);
            z2 = VERT(z2);
        }

        if (dtx->CursorX - dtx->Xmin > 0.1 || dtx->DisplayCursor==0) {
            /* MJK 12.02.98 */
            float2string (dtx, 0, x1, str);
            /*MiB*/  strcat(str,xdir1);
            plot_string( str, dtx->Xmin-0.02, dtx->Ymin-0.1, dtx->Zmin-0.125, bx, ux, 0 );
        }

        if (dtx->Xmax - dtx->CursorX > 0.1 || dtx->DisplayCursor==0) {
            /* MJK 12.02.98 */
            float2string (dtx, 0, x2, str);
            /*MiB*/  strcat(str,xdir2);
            plot_string( str, dtx->Xmax-0.05, dtx->Ymin-0.1, dtx->Zmin-0.125, bx, ux, 0 );
        }

        if (dtx->Ymax - dtx->CursorY > 0.1 || dtx->DisplayCursor==0) {
            /* MJK 12.02.98 */
            float2string (dtx, 1, y1, str);
            /*MiB*/  strcat(str,ydir1);
            plot_string( str, dtx->Xmin-0.075, dtx->Ymax-0.03, dtx->Zmin-0.075, by, uy, 1 );
        }

        if (dtx->CursorY-dtx->Ymin > 0.1 || dtx->DisplayCursor==0) {
            /* MJK 12.02.98 */
            float2string (dtx, 2, y2, str);
            /*MiB*/  strcat(str,ydir2);
            plot_string( str, dtx->Xmin-0.075, dtx->Ymin-0.02, dtx->Zmin-0.075, by, uy, 1 );
        }

        if (dtx->CursorZ-dtx->Zmin > 0.1 || dtx->DisplayCursor==0) {
            /* MJK 12.02.98 */
            float2string (dtx, 2, z1, str);
            plot_string( str, dtx->Xmin-0.07, dtx->Ymin-0.07, dtx->Zmin+0.005, bz, uz, 1 );
        }

        if (dtx->Zmax-dtx->CursorZ > 0.1 || dtx->DisplayCursor==0) {
            /* MJK 12.02.98 */
            float2string(dtx, 2, z2, str);
            plot_string( str, dtx->Xmin-0.07, dtx->Ymin-0.07, dtx->Zmax+0.005, bz, uz, 1 );
        }
    }

    set_depthcue( 0 );

}
Exemple #24
0
std::ostream& operator<<(std::ostream& os, Value const& sx)
{
  switch(sx.get_type())
  {
    case Value::Type::NIL:
      os << "()";
      break;

    case Value::Type::CONS:
      {
        os << '(';
        Value const* cur = &sx;
        do
        {
          if (cur->get_type() != Value::Type::CONS)
          {
            os << ". " << *cur;
            break;
          }
          else
          {
            os << cur->get_car();
            cur = &cur->get_cdr();
            if (*cur)
            {
              os << ' ';
            }
          }
        }
        while(*cur);
        os << ')';
      }
      break;

    case Value::Type::STRING:
      escape_string(os, sx.as_string());
      break;

    case Value::Type::INTEGER:
      os << sx.as_int();
      break;

    case Value::Type::REAL:
      float2string(os, sx.as_float());
      break;

    case Value::Type::SYMBOL:
      os << sx.as_string();
      break;

    case Value::Type::BOOLEAN:
      os << (sx.as_bool() ? "#t" : "#f");
      break;

    case Value::Type::ARRAY:
      {
        os << "#(";
        auto const& arr = sx.as_array();
        for(size_t i = 0; i != arr.size(); ++i)
        {
          if (i != 0) os << ' ';
          os << arr[i];
        }
        os << ")";
      }
      break;
  }

  return os;
}
void writeFloatPrecision(text_t *p, float number, int width, int precision)
{
  char str[20];
  char *fs = float2string(number, str, width, precision);
  writeStr(p, fs);
}
//-----------------------------------------------------------------------------------------
void gsBEncoder::getParameterDisplay (VstInt32 index, char* text)
{
	double val;
	getparameter(gen, index, &val);
	float2string((float)val, text, kVstMaxParamStrLen);
}
Exemple #27
0
int _dosprnt(const char *fmt, va_list args, char *obuf)
{
  char c, fill_char;
  char *s_arg;
  int i_arg;
  long l_arg;
  int width;
  int precision;
  char fstr[20];

  char *buf = obuf;
  while( (c = *fmt++) != 0 ) {

    if (c != '%') {
      buf += SPUTC(c, buf);
      continue;
    }
    c = *fmt++;
    width = 0;
    precision = 6;
    fill_char = ' ';
    if (c == '0') fill_char = '0';
    while (c && isdigit(c)) {
      width = 10*width + (c-'0');
      c = *fmt++;
    }
    if(c == '.') {
      precision = 0;
      c = *fmt++;
      while (c && isdigit(c)) {
        precision = 10*precision + (c-'0');
        c = *fmt++;
      }
    }
    if (!c)
      break;

    switch (c) {

      case '%':
        buf += SPUTC(c, buf);
        break;
  
      case 'b':
          l_arg = va_arg(args, int);
        buf += SPUTL(l_arg, 2, width, fill_char, buf);
        break;
  
      case 'c':
        i_arg = va_arg(args, int);
        buf += SPUTC(i_arg, buf);
        break;
  
      case 's':
        s_arg = va_arg(args, char *);
        buf += SPUTS(s_arg, buf);
        break;
  
      case 'd':
      case 'u':
        l_arg = va_arg(args, int);
        if (l_arg < 0 && c == 'd') {
          buf += SPUTC('-', buf);
          width--;
          l_arg = -l_arg;
        }
        buf += SPUTL(l_arg, 10, width, fill_char, buf);
        break;
#if 0
      case 'e':
      case 'g':
      {
        union { float f; int i; } a;
        a.i = va_arg(args, int);
        buf += SPUTS(floatToScientific(a.f), buf);
        break;
      }
#endif
      case 'f': {
        double d = va_arg(args, double);
        buf += SPUTS(float2string((float) d, fstr, width, precision), buf);
        break;
      }

      case 'x': {
        l_arg = va_arg(args, unsigned int);
        buf += SPUTL(l_arg, 16, width, fill_char, buf);
        break;
      }
    }
  }
  *buf = '\0';
  return buf-obuf;
}
Exemple #28
0
//-----------------------------------------------------------------------------------------
void AGain::getParameterDisplay (VstInt32 index, char* text)
{
    float2string (Band::filtor.coeff[index], text, kVstMaxParamStrLen);
}
Exemple #29
0
char Rain_Gauge::read_Analog(char * convertFloat, double volt_level){
  float val1 = analogRead(ANALOG1);
  val1 = (val1/1023) * volt_level;
  //function to convert floating point numbers to integers
  float2string(val1, convertFloat, 3);
}
Exemple #30
0
void RemoteControl::osciladores (byte comando) {
	
	//* durante el play se enlentece mucho
	// hay que hacer un flag is_playing para que las teclas adopten otra función
	// y falta la new feature: el damping factor
	//* las unidades de amplitud de rotación son muy grandes --> corregido?
	//* y las de amplitud de centro son muy chicas --> idem ?
	// falta una manera rápida de resetear todo --> hecho, aunque chancho
	// un boton reset y un boton "randomize" --> encaminado
	// en los modos normales de traslación y rotación, que vuelva a pos_ref en forma de oscilaciones dampereadas
	// que en las repeticiones aumente progresivamente el inc.
		
	static byte parametro = TRASL_X;
	byte sub_parametro;
	char increment = 0;
		
	switch (comando) {
		case RC_UP:
			if (pantalla.isBusy()) {break;}
			retardo = true;
			parametro = TRASL_Z;
			sub_parametro = AMP;
			increment = 1;
			break;
		
		case RC_DOWN:
			if (pantalla.isBusy()) {break;}
			retardo = true;
			parametro = TRASL_Z;
			sub_parametro = AMP;
			increment = -1;
			break;
		
		case RC_RIGHT:
			if (pantalla.isBusy()) {break;}
			retardo = true;
			parametro = TRASL_X;
			sub_parametro = AMP;
			increment = 1;
			break;
	
		case RC_LEFT:
			if (pantalla.isBusy()) {break;}
			retardo = true;
			parametro = TRASL_X;
			sub_parametro = AMP;
			increment = -1;
			break;

		case RC_MTS:
			if (pantalla.isBusy()) {break;}
			retardo = true;
			parametro = TRASL_Y;
			sub_parametro = AMP;
			increment = -1;
			break;
			
		case RC_MENU:
			if (pantalla.isBusy()) {break;}
			retardo = true;
			parametro = TRASL_Y;
			sub_parametro = AMP;
			increment = 1;
			break;
			
		case RC_CCTTX:
			if (pantalla.isBusy()) {break;}
			retardo = true;
			parametro %= 3;
			sub_parametro = BROWN;
			increment = -1;
			break;
			
		case RC_EXIT:
			if (pantalla.isBusy()) {break;}
			retardo = true;
			parametro %= 3;
			sub_parametro = BROWN;
			increment = 1;
			break;
			
		case RC_ENTER1:
			if (!isMoving) {
				texto1 = "PLAY";
				mov.oscilador (1, 32767);
				isMoving = true;
			} else {
				texto1 = "STOP";
				mov.stop();
				isMoving = false;
			}
			break;

		/* esto es más provisorio */
		////////////////////////////
		case 0:
			if (!isMoving) {
				texto1 = "Reset";
				mov.osc_reset ();
			} 
			break;
		
		case 1:
			if (!isMoving) {
				texto1 = "Random";    
				mov.osc_randomize (3, 1);      // en el futuro va a haber randomize sólo traslación, sólo rotación, etc
			}                           // ya está implementado a nivel de la clase "Movimiento"
			break;
		/////////////////////////////	
		/* termina zona de números */	
			
		case RC_CH_UP:
			if (pantalla.isBusy()) {break;}
			retardo = true;
			parametro %= 3;
			sub_parametro = PHASE;
			increment = 1;
			break;
			
		case RC_CH_DN:
			if (pantalla.isBusy()) {break;}
			retardo = true;
			parametro %= 3;
			sub_parametro = PHASE;
			increment = -1;
			break;
		
		case RC_VOL_UP:
			if (pantalla.isBusy()) {break;}
			retardo = true;
			parametro %= 3;
			sub_parametro = FREQ;
			increment = 1;
			break;
			
		case RC_VOL_DN:
			if (pantalla.isBusy()) {break;}
			retardo = true;
			parametro %= 3;
			sub_parametro = FREQ;
			increment = -1;
			break;
			
	}
	
	if (increment != 0) {
		float value = increment * inc;
		switch (modo) {
			case OSCILADORES1:
				parametro += TRASL_X;
				texto1 = "T.";
				break;
			case OSCILADORES2:
				parametro += CENTRO_X;
				texto1 = "C.";
				if (sub_parametro == AMP) {value *= 2;}         // ?
				break;
			case OSCILADORES3:
				parametro = 2-parametro;   // esto invierte los ejes X y Z 
				parametro += ROT_X;
				texto1 = "R.";
				if (sub_parametro == AMP) {value /= 15;}         // antes era * .1 (el 15 podría ser un #define, ya que aparece muchas veces)
				break;
		}
		switch (parametro % 3) {
			case TRASL_X: texto1 += "X."; break;
			case TRASL_Y: texto1 += "Y."; break;
			case TRASL_Z: texto1 += "Z."; break;
		}
		OSCILATOR osc = mov.get_oscilador (parametro);
		switch (sub_parametro) {
			case AMP: 
				value += osc.amp;
				texto1 += ("amp " + float2string (value)); 
				mov.set_amp (parametro, value);
				break;
			case FREQ: 
				value /= 5;
				value += osc.freq;
				texto1 += ("frq " + float2string (value)); 
				mov.set_freq (parametro, value);
				break;
			case PHASE: 
				value /= 5;
				value += osc.phase;
				texto1 += ("phs " + float2string (value)); 
				mov.set_phase (parametro, value);
				break;
			case BROWN: 
				bool brown = sign2bin (increment);
				texto1 += ("brw " + String (brown, BIN)); 
				mov.set_brown (parametro, brown);
				break;
		}
	}

}