Exemple #1
0
void SineOscil::setParameter( UINT16 paramId, FLOAT value, FLOAT modulation, INT16 voice )
{
    voice = min( numVoices_-1, voice );

    __assume( paramId < 4 );
    switch( paramId ) 
    {
	case PARAM_FREQUENCY:  
        if( voice >= 0 ) 
        {
            FLOAT freq;
            if( modulation < 0 ) {
                double pitch = Utils::freq2pitch( value );
                pitch        = ( pitch - 60 ) * modulation + 60;
                freq         = (FLOAT)Utils::pitch2freq( pitch );
            }
            else {
                freq = ( value - 261.62557f ) * modulation + 261.62557f;    
            }
        	freq_[ voice ] = freq;
	        setIncrement( voice );
        }
        break;
	case PARAM_AMPLITUDE: 
        if( voice >= 0 )
            amplitude_[ voice ] = value * modulation; 
        break;

	case PARAM_TUNING:     setTuning( value ); break;
    case PARAM_FINETUNING: setFineTuning( value ); break;
	}
}
Exemple #2
0
void SineOscil::setFineTuning( FLOAT paramValue )
{
    double pitch = max( -48, min( 84, paramValue ));  // -48: C0 (0Hz), C4 (261.63Hz), 84: C11 (33.488Hz)
    fineTuning_  = pow( 2, paramValue / 12 );

	for( UINT16 i=0; i<numVoices_; i++ ) {
		setIncrement( i );
	}
}
/**
   Allows the choice of increment from a range, only one of this and
   laserAllowIncrementChoices should be used.

   @param defaultIncrement The default increment to use, this
   default should be a reasonable value.

   @param incrementMin The minimum value for the increment

   @param incrementMax The maximum value for the increment
**/
AREXPORT void ArLaser::laserAllowSetIncrement(
	double defaultIncrement, double incrementMin, double incrementMax)
{
  myCanSetIncrement = true;
  myIncrementMin = incrementMin;
  myIncrementMax = incrementMax;
  setIncrement(defaultIncrement);
  myIncrementSet = false;

}
Exemple #4
0
void SineOscil::setTuning( FLOAT paramValue )
{
    double pitch = (double)(INT32)paramValue;
    pitch        = min( 84, pitch );              // -48: C0 (0Hz), C4 (261.63Hz), 84: C11 (33.488Hz)
	tuning_      = pow( 2, pitch / 12 );

	for( UINT16 i=0; i<numVoices_; i++ ) {
        setIncrement( i );
	}
}
short ElemDDLSGOptions::importSGO(const ElemDDLSGOptions *sgo)
{
  if (sgo->isStartValueSpecified())
    {
      setStartValueSpec(TRUE);
      setStartValue(sgo->getStartValue());
    }

  if (sgo->isIncrementSpecified())
    {
      setIncrementSpec(TRUE);
      setIncrement(sgo->getIncrement());
    }

  if (sgo->isMinValueSpecified())
    {
      setMinValueSpec(TRUE);
      
      if (sgo->isNoMinValue())
        setNoMinValue(TRUE);
      else
        setMinValue(sgo->getMinValue());
    }

  if (sgo->isMaxValueSpecified())
    {
      setMaxValueSpec(TRUE);

      if (sgo->isNoMaxValue())
        setNoMaxValue(TRUE);
      else
        setMaxValue(sgo->getMaxValue());
    }

  if (sgo->isCacheSpecified())
    {
      setCacheSpec(TRUE);
      setCache(sgo->getCache());
    }

  if (sgo->isCycleSpecified())
    {
      setCycleSpec(TRUE);
      setCycle(sgo->isCycle());
    }

  if (sgo->isResetSpecified())
    {
      setResetSpec();
      setReset(sgo->isReset());
    }

  return 0;
}
ofxSimpleGuiSliderBase<Type>::ofxSimpleGuiSliderBase(string name, Type &value, Type min, Type max) : ofxSimpleGuiControl(name) {
	this->value = &value;
	defaultValue = value;
	this->min	= min;
	this->max	= max;
	
	targetValue	= value;
	oldValue	= targetValue;
	controlType = "SliderBase";
	
	setIncrement(0);
	setSmoothing(0);
	
	setup();
}
short ElemDDLSGOptions::importSGA(const SequenceGeneratorAttributes *sga)
{
  initializeDataMembers();

  setFSDataType(sga->getSGFSDataType());
  setStartValue(sga->getSGStartValue());
  setIncrement(sga->getSGIncrement());
  setMinValue(sga->getSGMinValue());
  setMaxValue(sga->getSGMaxValue());

  setCache(sga->getSGCache());
  setCycle(sga->getSGCycleOption());

  setReset(sga->getSGResetOption());

  return 0;
}
Exemple #8
0
bool AD5933_Class::getGainFactorS_TP(double cResistance, int avgNum, double startFreq, double endFreq, double &GF_Init, double &GF_Incr, double &PS_Init, double &PS_Incr)
{
	int ctrReg = getByte(0x80);
	byte numIncrementBackup = numIncrement;
	long incrHexBackup = incrHex;
	setNumofIncrement(1);
	setIncrement(endFreq - startFreq);
	if (setCtrMode(STAND_BY, ctrReg) == false)
	{
		return false;
	}
	if (setCtrMode(INIT_START_FREQ, ctrReg) == false)
	{
		return false;
	}
	if (setCtrMode(START_FREQ_SWEEP, ctrReg) == false)
	{
		return false;
	}

	int t1 = 0;
	int rImag, rReal;
	double sumMag = 0, sumPhase = 0;
	for (t1 = 0; t1 < avgNum; t1++)
	{
		getComplexRawOnce(rReal, rImag); // Only for real and Imag components.
		sumMag += getMag(rReal, rImag);
		sumPhase += atan2(rImag, rReal);

		if (setCtrMode(REPEAT_FREQ, ctrReg) == false)
		{
			return false;
		}
	}
	GF_Init = (sumMag / avgNum) * cResistance;
	PS_Init = sumPhase / avgNum;

	setCtrMode(INCR_FREQ, ctrReg);
	sumMag = 0;
	sumPhase = 0;

	for (t1 = 0; t1 < avgNum; t1++)
	{
		getComplexRawOnce(rReal, rImag); // Only for real and Imag components.
		sumMag += getMag(rReal, rImag);
		sumPhase += atan2(rImag, rReal);

		if (setCtrMode(REPEAT_FREQ, ctrReg) == false)
		{
			return false;
		}
	}
	GF_Incr = ((sumMag / avgNum) * cResistance - GF_Init) / numIncrementBackup;
	PS_Incr = ((sumPhase / avgNum) - PS_Init) / numIncrementBackup;


	if (setCtrMode(POWER_DOWN, ctrReg) == false)
	{
		return false;
	}
	setNumofIncrement(numIncrementBackup);
	setIncrementinHex(incrHexBackup);
	return true; // Succeed!
}
AREXPORT bool ArLaser::laserPullUnsetParamsFromRobot(void)
{
  if (myRobot == NULL)
  {
    ArLog::log(ArLog::Normal, "%s: Trying to connect, but have no robot, continuing under the assumption this is intentional", getName());
    return true;
  }

  const ArRobotParams *params = myRobot->getRobotParams();
  if (params == NULL)
  {
    ArLog::log(ArLog::Terse, 
	       "%s: Robot has no params, cannot pull unset params from robot",
	       getName());
    return false;
  }

  const char *paramStr;
  char *endPtr;
  double paramDouble;
  int paramInt;
  bool paramBool;

  paramBool = params->getLaserFlipped(getLaserNumber());
  if (!myFlippedSet)
  {
    if (paramBool)
    {
      ArLog::log(myInfoLogLevel, 
		 "%s: Setting flipped to true from robot params",
		 getName());
      setFlipped(true);
    }
    else if (!paramBool)
    {
      ArLog::log(myInfoLogLevel, 
		 "%s: Setting flipped to false from robot params",
		 getName());
      setFlipped(false);
    }
  }

  paramInt = params->getLaserMaxRange(getLaserNumber());
  if (!myMaxRangeSet)
  {
    if(paramInt < 0)
    {
      ArLog::log(ArLog::Terse, "%s: LaserMaxRange in robot param file was negative but shouldn't be (it was '%d'), failing", getName(), paramInt);
      return false;
    }
    if (paramInt > 0)
    {
      ArLog::log(myInfoLogLevel, 
		 "%s: Setting max range to %d from robot params",
		 getName(), paramInt);
      setMaxRange(paramInt);
    }
  }

  paramInt = params->getLaserCumulativeBufferSize(getLaserNumber());
  if (!myCumulativeBufferSizeSet)
  {
    if(paramInt < 0)
    {
      ArLog::log(ArLog::Terse, "%s: LaserCumulativeBufferSize in robot param file was negative but shouldn't be (it was '%d'), failing", getName(), paramInt);
      return false;
    }
    if (paramInt > 0)
    {
      ArLog::log(myInfoLogLevel, 
		 "%s: Setting cumulative buffer size to %d from robot params",
		 getName(), paramInt);
      setCumulativeBufferSize(paramInt);
    }
  }

  paramStr = params->getLaserStartDegrees(getLaserNumber());
  if (canSetDegrees() && !myStartDegreesSet && 
      paramStr != NULL && paramStr[0] != '\0')
  {
    paramDouble = strtod(paramStr, &endPtr);
    if(endPtr == paramStr)
    {
      ArLog::log(ArLog::Terse, "%s: LaserStartDegrees in robot param file was not a double (it was '%s'), failing", getName(), paramStr);
      return false;
    }
    ArLog::log(myInfoLogLevel, 
	       "%s: Setting start degrees to %g from robot params",
	       getName(), paramDouble);
    setStartDegrees(paramDouble);
  }

  paramStr = params->getLaserEndDegrees(getLaserNumber());
  if (canSetDegrees() && !myEndDegreesSet && 
      paramStr != NULL && paramStr[0] != '\0')
  {
    paramDouble = strtod(paramStr, &endPtr);
    if(endPtr == paramStr)
    {
      ArLog::log(ArLog::Terse, 
		 "%s: LaserEndDegrees in robot param file was not a double (it was '%s'), failing", 
		 getName(), paramStr);
      return false;
    }
    ArLog::log(myInfoLogLevel, 
	       "%s: Setting end degrees to %g from robot params",
	       getName(), paramDouble);
    setEndDegrees(paramDouble);
  }

  paramStr = params->getLaserDegreesChoice(getLaserNumber());
  if (canChooseDegrees() && !myDegreesChoiceSet && 
      paramStr != NULL && paramStr[0] != '\0')
  {
    ArLog::log(myInfoLogLevel, 
	       "%s: Setting degrees choice to %s from robot params",
	       getName(), paramStr);
    chooseDegrees(paramStr);
  }

  paramStr = params->getLaserIncrement(getLaserNumber());
  if (canSetDegrees() && !myIncrementSet && 
      paramStr != NULL && paramStr[0] != '\0')
  {
    paramDouble = strtod(paramStr, &endPtr);
    if(endPtr == paramStr)
    {
      ArLog::log(ArLog::Terse, 
		 "%s: LaserIncrement in robot param file was not a double (it was '%s'), failing", 
		 getName(), paramStr);
      return false;
    }
    ArLog::log(myInfoLogLevel, 
	       "%s: Setting increment to %g from robot params",
	       getName(), paramDouble);
    setIncrement(paramDouble);
  }

  paramStr = params->getLaserIncrementChoice(getLaserNumber());
  if (canChooseIncrement() && !myIncrementChoiceSet && 
      paramStr != NULL && paramStr[0] != '\0')
  {
    ArLog::log(myInfoLogLevel, 
	       "%s: Setting increment choice to %s from robot params",
	       getName(), paramStr);
    chooseIncrement(paramStr);
  }

  paramStr = params->getLaserUnitsChoice(getLaserNumber());
  if (canChooseUnits() && !myUnitsChoiceSet && 
      paramStr != NULL && paramStr[0] != '\0')
  {
    ArLog::log(myInfoLogLevel, 
	       "%s: Setting units choice to %s from robot params",
	       getName(), paramStr);
    chooseUnits(paramStr);
  }

  paramStr = params->getLaserReflectorBitsChoice(getLaserNumber());
  if (canChooseReflectorBits() && !myReflectorBitsChoiceSet && 
      paramStr != NULL && paramStr[0] != '\0')
  {
    ArLog::log(myInfoLogLevel, 
	       "%s: Setting reflectorBits choice to %s from robot params",
	       getName(), paramStr);
    chooseReflectorBits(paramStr);
  }

  paramBool = params->getLaserPowerControlled(getLaserNumber());
  if (canSetPowerControlled() && !myPowerControlledSet)
  {
    if (paramBool)
    {
      ArLog::log(myInfoLogLevel, 
		 "%s: Setting powerControlled to true from robot params",
		 getName());
      setPowerControlled(true);
    }
    else if (!paramBool)
    {
      ArLog::log(myInfoLogLevel, 
		 "%s: Setting powerControlled to false from robot params",
		 getName());
      setPowerControlled(false);
    }
  }

  paramStr = params->getLaserStartingBaudChoice(getLaserNumber());
  if (canChooseStartingBaud() && !myStartingBaudChoiceSet && 
      paramStr != NULL && paramStr[0] != '\0')
  {
    ArLog::log(myInfoLogLevel,
	       "%s: Setting startingBaud choice to %s from robot params",
	       getName(), paramStr);
    chooseStartingBaud(paramStr);
  }

  paramStr = params->getLaserAutoBaudChoice(getLaserNumber());
  if (canChooseAutoBaud() && !myAutoBaudChoiceSet && 
      paramStr != NULL && paramStr[0] != '\0')
  {
    ArLog::log(myInfoLogLevel, 
	       "%s: Setting autoBaud choice to %s from robot params",
	       getName(), paramStr);
    chooseAutoBaud(paramStr);
  }

  if (!addIgnoreReadings(params->getLaserIgnore(getLaserNumber())))
    return false;

  setSensorPosition(params->getLaserX(getLaserNumber()), 
		    params->getLaserY(getLaserNumber()), 
		    params->getLaserTh(getLaserNumber()),
		    params->getLaserZ(getLaserNumber()));

  return true;
}
Exemple #10
0
//------------------------------------------------------------------------------
// setSlotIncrement() - increment of our tape
//------------------------------------------------------------------------------
bool Tape::setSlotIncrement(const Basic::Number* const x)
{
    bool ok = false;
    if (x != 0) ok = setIncrement(x->getInt());
    return ok;
}
void ofxSimpleGuiSliderBase<Type>::increase(float incrementFactor) {
	//if(increment == 0) setIncrement((max - min) * incrementFactor);
	//		oldValue = *value;		// save oldValue (so the draw doesn't update target but uses it)
	setIncrement((max - min) * incrementFactor);
	setTargetValue(*value + increment);
}
void ofxSimpleGuiSliderInt::decrease(float incrementFactor) {
	setIncrement((max - min) * incrementFactor);
	if(increment < 1)
		increment = 1;
	setTargetValue(*value - increment);
}
ofxSimpleGuiSliderInt::ofxSimpleGuiSliderInt(string name, int &value, int min, int max) : ofxSimpleGuiSliderBase<int>(name, value, min, max) {
	controlType = "SliderInt";
	setIncrement(1);
}
// queryType:  0, create sequence.  1, alter sequence.  2, IDENTITY col.
short ElemDDLSGOptions::validate(short queryType)
{
  char queryTypeStr[40];

  if (queryType == 0)
    strcpy(queryTypeStr, "CREATE SEQUENCE");
  else if (queryType == 1)
    strcpy(queryTypeStr, "ALTER SEQUENCE");
  else
    strcpy(queryTypeStr, "IDENTITY column");

  Int64 minValue = 0;
  Int64 startValue = 0;
  Int64 increment = 0;
  Int64 maxValue = LONG_MAX - 1;

  NAString dtStr;
  if (fsDataType_ != COM_UNKNOWN_FSDT)
    {
      switch (fsDataType_)
        {
        case COM_UNSIGNED_BIN16_FSDT:
          maxValue = USHRT_MAX;
          dtStr = COM_SMALLINT_UNSIGNED_SDT_LIT;
          break;
        case COM_UNSIGNED_BIN32_FSDT:
          maxValue = UINT_MAX;
          dtStr = COM_INTEGER_UNSIGNED_SDT_LIT;
          break;
        case COM_SIGNED_BIN64_FSDT:
          maxValue = LONG_MAX - 1;
          dtStr =  COM_LARGEINT_SIGNED_SDT_LIT;
          break;
        default:
          *CmpCommon::diags() << DgSqlCode(-1510);
          return -1;
        }
    }

  if (queryType == 1) // alter
    {
      if ((isMinValueSpecified()|| isStartValueSpecified()))
        {
          *CmpCommon::diags() << DgSqlCode(-1592)
                              << (isMinValueSpecified() ? DgString0("MINVALUE") : DgString0("START WITH"))
                              << DgString1(queryTypeStr);
          
          return -1;
        }
      
      minValue = getMinValue();
      startValue = getStartValue();
      increment = getIncrement();

      if (isMaxValueSpecified() && (NOT isNoMaxValue()))
        {
          if ((fsDataType_ != COM_UNKNOWN_FSDT) &&
              (getMaxValue() > maxValue))
            {
              *CmpCommon::diags() << DgSqlCode(-1576)
                                  << DgString0("MAXVALUE")
                                  << DgString1(dtStr);
              
              return -1;
            }
        }

      maxValue = getMaxValue();
    } // alter
  else
    {
      if (isResetSpecified())
        {
          *CmpCommon::diags() << DgSqlCode(-1592)
                              << DgString0("RESET") 
                              << DgString1(queryTypeStr);
          
          return -1;
        }
 
      minValue = ((isMinValueSpecified() && (NOT isNoMinValue())) ? 
                  getMinValue() : 1LL); 
      startValue = (isStartValueSpecified() ? getStartValue() : minValue);
      increment = (isIncrementSpecified() ? getIncrement() : 1LL);
    } //else

  if (isMaxValueSpecified() && (NOT isNoMaxValue()))
    {
      if ((fsDataType_ != COM_UNKNOWN_FSDT) &&
          (getMaxValue() > maxValue))
        {
          *CmpCommon::diags() << DgSqlCode(-1576)
                              << DgString0("MAXVALUE")
                              << DgString1(dtStr);
          
          return -1;
        }

      maxValue = getMaxValue();
    }

  if (minValue == 0)
    {
      *CmpCommon::diags() << DgSqlCode(-1571)
			  << DgString0("MINVALUE")
			  << DgString1(queryTypeStr);
      
      return -1;
    }

  if (minValue < 0)
    {
      *CmpCommon::diags() << DgSqlCode(-1572)
			  << DgString0("MINVALUE")
			  << DgString1(queryTypeStr);
      
      return -1;
    }

  if (maxValue == 0)
    {
      *CmpCommon::diags() << DgSqlCode(-1571)
			  << DgString0("MAXVALUE")
			  << DgString1(queryTypeStr);
      
      return -1;
    }

  if (maxValue < 0)
    {
      *CmpCommon::diags() << DgSqlCode(-1572)
			  << DgString0("MAXVALUE")
			  << DgString1(queryTypeStr);
      
      return -1;
    }

  if (increment == 0)
    {
      *CmpCommon::diags() << DgSqlCode(-1571)
			  << DgString0("INCREMENT BY")
			  << DgString1(queryTypeStr);
      
      return -1;
    }

  if (increment < 0)
    {
      *CmpCommon::diags() << DgSqlCode(-1572)
			  << DgString0("INCREMENT BY")
			  << DgString1(queryTypeStr);  
      return -1;
    }

  if (startValue < 0)
    {
      *CmpCommon::diags() << DgSqlCode(-1572)
			  << DgString0("START WITH")
			  << DgString1(queryTypeStr);
      
      return -1;
    }

  if (maxValue <= minValue)
    {
      *CmpCommon::diags() << DgSqlCode(-1570)
			  << DgString0(queryTypeStr);      
      return -1;
    }

  if (startValue > maxValue)
    {
      *CmpCommon::diags() << DgSqlCode(-1573)
			  << DgString0(queryTypeStr);      
      return -1;
    }

  if (startValue < minValue)
    {
      *CmpCommon::diags() << DgSqlCode(-1573)
			  << DgString0(queryTypeStr);      
      return -1;
    }

  if (increment > (maxValue - minValue))
    {
      *CmpCommon::diags() << DgSqlCode(-1575)
			  << DgString0(queryTypeStr);      
      return -1;
    }

  Int64 cache = 0;
  Int64 minVal = MAXOF(startValue, minValue);
  Int64 rangeOfVals = (maxValue-minVal)/increment + 1;

  if (isCacheSpecified())
    cache = getCache();
  else
    cache = MINOF(rangeOfVals, 25);

  if (NOT isNoCache())
    {
      if ((cache <= 1) ||
	  (cache > rangeOfVals))
	{
	  *CmpCommon::diags() << DgSqlCode(-1577)
			      << DgString0(queryTypeStr);	  
	  return -1;
	}
    }
  
  cache = MINOF(rangeOfVals, cache);

  setStartValue(startValue);
  setIncrement(increment);
  setMinValue(minValue);
  setMaxValue(maxValue);
  if (NOT isCacheSpecified())
    setCache(cache);

  return 0;
}
Exemple #15
0
/* ----------------------------------------------------------------------------*/
void selectBand(GtkWidget* widget) {
    GtkWidget* label;
    BANDSTACK_ENTRY* entry;
    XVTR_ENTRY* xvtr_entry;
    int current;

    resetSubRx();

    if(currentBandButton) {
        label=gtk_bin_get_child((GtkBin*)currentBandButton);
        gtk_widget_modify_fg(label, GTK_STATE_NORMAL, &black);
        gtk_widget_modify_fg(label, GTK_STATE_PRELIGHT, &white);
    }
    label=gtk_bin_get_child((GtkBin*)widget);
    gtk_widget_modify_fg(label, GTK_STATE_NORMAL, &buttonSelected);
    gtk_widget_modify_fg(label, GTK_STATE_PRELIGHT, &buttonSelected);

    //save current
    if(currentBandButton) {
        if(displayHF) {
            currentHFButton=currentBandButton;
            current=bandstack[band].current_entry;
            entry=&bandstack[band].entry[current];
            entry->frequencyA=frequencyA;
            entry->mode=mode;
            entry->filter=filter;
            entry->var1Low=filterVar1Low;
            entry->var1High=filterVar1High;
            entry->var2Low=filterVar2Low;
            entry->var2High=filterVar2High;
            entry->step=frequencyIncrement;
            entry->preamp=preamp;
            entry->spectrumHigh=spectrumMAX;
            entry->spectrumLow=spectrumMIN;
            entry->spectrumStep=spectrumSTEP;
            entry->waterfallHigh=waterfallHighThreshold;
            entry->waterfallLow=waterfallLowThreshold;
        } else {
            currentXVTRButton=currentBandButton;
            xvtr_entry=&xvtr[xvtr_band];
            xvtr_entry->rxFrequency=frequencyA;
            xvtr_entry->txFrequency=frequencyB;
            xvtr_entry->mode=mode;
            xvtr_entry->filter=filter;
            xvtr_entry->var1Low=filterVar1Low;
            xvtr_entry->var1High=filterVar1High;
            xvtr_entry->var2Low=filterVar2Low;
            xvtr_entry->var2High=filterVar2High;
            xvtr_entry->step=frequencyIncrement;
            xvtr_entry->preamp=preamp;
            xvtr_entry->spectrumHigh=spectrumMAX;
            xvtr_entry->spectrumLow=spectrumMIN;
            xvtr_entry->spectrumStep=spectrumSTEP;
            xvtr_entry->waterfallHigh=waterfallHighThreshold;
            xvtr_entry->waterfallLow=waterfallLowThreshold;
        }
    }

    if(widget==buttonBand14) {
        // XVTR / HF
        displayHF=!displayHF;
        if(displayHF) {
            currentBandButton=NULL;
            setHFTitles();
            setBand(band);
            //selectBand(currentHFButton);
        } else {
            currentBandButton=NULL;
            setXVTRTitles();
            setBand(xvtr_band);
            //selectBand(currentXVTRButton);
        }
    } else {
        if(displayHF) {
            setLOFrequency(0LL);
            if(currentBandButton==widget) {
                bandstack[band].current_entry++;
                if(bandstack[band].current_entry>=bandstack[band].entries) {
                    bandstack[band].current_entry=0;
                }
            } else {
                currentBandButton=widget;
                if(widget==buttonBand1) {
                    band=band160;
                } else if(widget==buttonBand2) {
                    band=band80;
                } else if(widget==buttonBand3) {
                    band=band60;
                } else if(widget==buttonBand4) {
                    band=band40;
                } else if(widget==buttonBand5) {
                    band=band30;
                } else if(widget==buttonBand6) {
                    band=band20;
                } else if(widget==buttonBand7) {
                    band=band17;
                } else if(widget==buttonBand8) {
                    band=band15;
                } else if(widget==buttonBand9) {
                    band=band12;
                } else if(widget==buttonBand10) {
                    band=band10;
                } else if(widget==buttonBand11) {
                    band=band6;
                } else if(widget==buttonBand12) {
                    band=bandGen;
                } else if(widget==buttonBand13) {
                    band=bandWWV;
                } else if(widget==buttonBand14) {
                    band=bandXVTR;
                }
            }

            current=bandstack[band].current_entry;
            entry=&bandstack[band].entry[current];

            {
                int *m=malloc(sizeof(int));
                *m=entry->mode;
                setMode(m);
            }
            filterVar1Low=entry->var1Low;
            filterVar1High=entry->var1High;
            filterVar2Low=entry->var2Low;
            filterVar2High=entry->var2High;
            setFilter(entry->filter);
            {
                long long *f=malloc(sizeof(long long));
                *f=entry->frequencyA;
                setAFrequency(f);
            }
            setIncrement(entry->step);

            //setPreamp(entry->preamp);
            forcePreamp(entry->preamp);

            spectrumMAX=entry->spectrumHigh;
            spectrumMIN=entry->spectrumLow;
            spectrumSTEP=entry->spectrumStep;
            waterfallHighThreshold=entry->waterfallHigh;
            waterfallLowThreshold=entry->waterfallLow;
        } else {
            currentBandButton=widget;

            if(widget==buttonBand1) {
                xvtr_band=band160;
            } else if(widget==buttonBand2) {
                xvtr_band=band80;
            } else if(widget==buttonBand3) {
                xvtr_band=band60;
            } else if(widget==buttonBand4) {
                xvtr_band=band40;
            } else if(widget==buttonBand5) {
                xvtr_band=band30;
            } else if(widget==buttonBand6) {
                xvtr_band=band20;
            } else if(widget==buttonBand7) {
                xvtr_band=band17;
            } else if(widget==buttonBand8) {
                xvtr_band=band15;
            } else if(widget==buttonBand9) {
                xvtr_band=band12;
            } else if(widget==buttonBand10) {
                xvtr_band=band10;
            } else if(widget==buttonBand11) {
                xvtr_band=band6;
            } else if(widget==buttonBand12) {
                xvtr_band=bandGen;
            }

            xvtr_entry=&xvtr[xvtr_band];
            {
                int *m=malloc(sizeof(int));
                *m=xvtr_entry->mode;
                setMode(m);
            }
            filterVar1Low=xvtr_entry->var1Low;
            filterVar1High=xvtr_entry->var1High;
            filterVar2Low=xvtr_entry->var2Low;
            filterVar2High=xvtr_entry->var2High;
            setFilter(xvtr_entry->filter);
            setLOFrequency(xvtr_entry->rxFrequencyLO);
            {
                long long *f=malloc(sizeof(long long));
                *f=xvtr_entry->rxFrequency;
                setAFrequency(f);
            }
            setIncrement(xvtr_entry->step);

            //setPreamp(xvtr_entry->preamp);
            forcePreamp(xvtr_entry->preamp);

            spectrumMAX=xvtr_entry->spectrumHigh;
            spectrumMIN=xvtr_entry->spectrumLow;
            spectrumSTEP=xvtr_entry->spectrumStep;
            waterfallHighThreshold=xvtr_entry->waterfallHigh;
            waterfallLowThreshold=xvtr_entry->waterfallLow;

        }
    }
}