Beispiel #1
0
void LogVariablesWidget::on_logVariableTable_itemChanged(QTableWidgetItem *item)
{
	if ( item->column() == 1 )      // Frequency
	{
		setFrequency(item->row(), item->text().toDouble());
	}
	else if ( item->column() == 2 ) // Start Time
	{
		setStartTime(item->row(), item->text().toDouble());
	}
	else if ( item->column() == 3 ) // Duration
	{
        setDuration(item->row(), item->text().toDouble());
    }
}
Beispiel #2
0
void SynthEvent::applyModules( SynthInstrument* instrument )
{
    bool hasOSC2   = _osc2 != 0;
    float OSC2freq = hasOSC2 ? _osc2->_baseFrequency : _baseFrequency;

    if ( instrument->arpeggiatorActive )
    {
        if ( _arpeggiator == 0 )
            _arpeggiator = instrument->arpeggiator->clone();
        else
            instrument->arpeggiator->cloneProperties( _arpeggiator );
    }
    else if ( _arpeggiator != 0 )
    {
        delete _arpeggiator;
        _arpeggiator = 0;
    }

    if ( hasOSC2 )
        _osc2->applyModules( instrument );

    // pitch shift module active ? make sure current frequency
    // matches the current arpeggiator step
    if ( instrument->arpeggiatorActive )
    {
        setFrequency( _arpeggiator->getPitchForStep( _arpeggiator->getStep(), _baseFrequency ), true, false );
    }
    else
    {
        // restore base frequency upon deactivation of pitch shift modules
        setFrequency( _baseFrequency, false, true );

        if ( hasOSC2 )
            _osc2->setFrequency( OSC2freq, false, true );
    }
}
Beispiel #3
0
void sim_bandstack_cb(GtkWidget *widget, gpointer data) {
  BANDSTACK_ENTRY *entry;
  fprintf(stderr,"sim_bandstack_cb\n");
  if(function) {
    entry=bandstack_entry_previous();
  } else {
    entry=bandstack_entry_next();
  }
  setFrequency(entry->frequencyA);
  setMode(entry->mode);
  FILTER* band_filters=filters[entry->mode];
  FILTER* band_filter=&band_filters[entry->filter];
  setFilter(band_filter->low,band_filter->high);
  vfo_update(NULL);
}
Beispiel #4
0
void CubicSDR::setDevice(SDRDeviceInfo *dev) {
    if (!sdrThread->isTerminated()) {
        sdrThread->terminate();
        if (t_SDR) {
            t_SDR->join();
            delete t_SDR;
        }
    }
    
    for (SoapySDR::Kwargs::const_iterator i = settingArgs.begin(); i != settingArgs.end(); i++) {
        sdrThread->writeSetting(i->first, i->second);
    }
    sdrThread->setStreamArgs(streamArgs);
    sdrThread->setDevice(dev);
    
    DeviceConfig *devConfig = config.getDevice(dev->getDeviceId());
    
    SoapySDR::Device *soapyDev = dev->getSoapyDevice();
    
    if (soapyDev) {
        //long long freqHigh, freqLow;
        
        //SoapySDR::RangeList freqRange = soapyDev->getFrequencyRange(SOAPY_SDR_RX, 0);
        
        //freqLow = freqRange[0].minimum();
        //freqHigh = freqRange[freqRange.size()-1].maximum();

        // Try for a reasonable default sample rate.
        if (!sampleRateInitialized.load()) {
            sampleRate = dev->getSampleRateNear(SOAPY_SDR_RX, 0, DEFAULT_SAMPLE_RATE);
            sampleRateInitialized.store(true);
        } else {
            sampleRate = dev->getSampleRateNear(SOAPY_SDR_RX, 0, sampleRate);
        }

        if (frequency < sampleRate/2) {
            frequency = sampleRate/2;
        }

        setFrequency(frequency);
        setSampleRate(sampleRate);

        setPPM(devConfig->getPPM());
        setOffset(devConfig->getOffset());

        t_SDR = new std::thread(&SDRThread::threadMain, sdrThread);
    }
}
Beispiel #5
0
/* 
 * This thread performs a scan operation based on the scanDirection value.
 *
 * scanDirection = 0: scan forward continuously, pausing at each found station
 * scanDirection = 1: scan forward until a station is found
 * scanDirection = -1: scan backward until a station is found
 */
void RadioWidget::run()
{
   threadRunning = TRUE;

   int signal = 0;

   // loop while no station found or the mode is 'continuous scan'
   while ((signal <= 0) || (scanDirection == 0))
   {
      if (scanDirection >= 0)
      {
         frequency = frequency + 0.2;
         if (frequency > 107.9)
            frequency = 87.9;
      } else
      {
         frequency = frequency - 0.2;
         if (frequency < 87.9)
            frequency = 107.9;
      }
      
      setFrequency(frequency);
      
      // don't know why, but lcd must be told to repaint to show the freq.
      QThread::postEvent( lcd, new QPaintEvent( QRect(0, 0, 580, 300) ) );
      
      // check it thread cancel was requested
      if (threadRunning == FALSE) break;

      // pause is necessary for a correct reading of the signal strength
      QThread::msleep(200);  
      signal = getSignalStrength();
      
      // if in 'continuous scan' mode and station pause, stay here for 3 sec.
      if ((scanDirection == 0) && (signal > 0))
         QThread::sleep(3);
      
      // check again to see if thread cancel was requested
      if (threadRunning == FALSE) break;
   }

   // untoggle all the control buttons
   scan->untoggle();
   scanForward->untoggle();
   scanBackward->untoggle();

   threadRunning = FALSE;
}
Beispiel #6
0
boolean VCNL4010::begin(uint8_t addr) {
  _i2caddr = addr;
  Wire.begin();

  uint8_t rev = read8(VCNL4010_PRODUCTID);
  //Serial.println(rev, HEX);
  if ((rev & 0xF0) != 0x20) {
    return false;
  }
  
  setLEDcurrent(20);
  setFrequency(VCNL4010_390K625);

  write8(VCNL4010_INTCONTROL, 0x08);
  return true;
}
Beispiel #7
0
//////////////////////////////////////////////////////////////////////////////
//  Increment the frequency by this digit active in edit mode
//////////////////////////////////////////////////////////////////////////////
void CFreqCtrl::incFreq()
{
    if (m_ActiveEditDigit >= 0)
    {
        if (m_DigitInfo[m_ActiveEditDigit].editmode)
        {
            m_freq += m_DigitInfo[m_ActiveEditDigit].incval;
            if (m_ResetLowerDigits) {
                /* Set digits below the active one to 0 */
                m_freq = m_freq - m_freq%m_DigitInfo[m_ActiveEditDigit].weight;
            }
            setFrequency(m_freq);
            m_LastEditDigit = m_ActiveEditDigit;
        }
    }
}
Beispiel #8
0
void setLoRaMode(int Channel)
{
	double Frequency;

	// LogMessage("Setting LoRa Mode\n");
	setMode(Channel, RF96_MODE_SLEEP);
	writeRegister(Channel, REG_OPMODE,0x80);
	
	setMode(Channel, RF96_MODE_SLEEP);
  
	if (sscanf(Config.LoRaDevices[Channel].Frequency, "%lf", &Frequency))
	{
		// LogMessage("Set Default Frequency\n");
		setFrequency(Channel, Frequency);
	}
}
void wsMessageReceived(WebSocket& socket, const String& message)
{
	WebSocketsList &clients = server.getActiveWebSockets();

    StaticJsonBuffer<200> jsonBuffer;
    JsonObject& root = jsonBuffer.parseObject(message);
    String actionName  = root["name"].asString();
 
    if(actionName=="enhance"){
    	setEnhance(!enhance);
    }else if(actionName=="power"){
    	setPower(!power);
    }else if(actionName=="mute"){
    	setMmute(!mute);
    }else if(actionName=="mixing"){
    	setMixing(!mixing);
    }else if(actionName=="frequency"){
		setFrequency(root["val"]);
    }else if(actionName=="source"){
		setSource(root["val"]);
    }else if (actionName == "volumeFR") {
        setVolume(CHAN_FR, root["val"]);
    } else if (actionName == "volumeFL") {
        setVolume(CHAN_FL, root["val"]);
    } else if (actionName == "volumeRR") {
        setVolume(CHAN_RR, root["val"]);
    } else if (actionName == "volumeRL") {
        setVolume(CHAN_RL, root["val"]);
    } else if (actionName == "volumeCEN") {
        setVolume(CHAN_CEN, root["val"]);
    } else if (actionName == "volumeSW") {
        setVolume(CHAN_SW, root["val"]);
    } else if (actionName == "volumeALLCH") {
        setVolume(CHAN_ALL, root["val"]);
    } else if (actionName == "volumeSW") {
        setVolume(CHAN_SW, root["val"]);
    } else if (actionName == "lcdText") {
        setLcd(root["line"], root["val"]);
    }





	sendUpdate();
	Serial.printf("WebSocket message received:\r\n%s\r\n", actionName);
}
// BGG -- eliminated the ADSR (breath amp now comes in through
// 	the tick() method) and the vibrato
Brass :: Brass(MY_FLOAT lowestFrequency)
{
  length = (long) (Stk::sampleRate() / lowestFrequency + 1);
  delayLine = new DelayA( 0.5 * length, length );

  lipFilter = new BiQuad();
  lipFilter->setGain( 0.03 );
  dcBlock = new PoleZero();
  dcBlock->setBlockZero();

  this->clear();
	maxPressure = (MY_FLOAT) 0.0;
  lipTarget = 0.0;

  // Necessary to initialize variables.
  setFrequency( 220.0 );
}
Beispiel #11
0
bool Hamlib::handleRequest(Session::ref session, Request::ref request, Reply::ref reply) {
	std::string uri = request->getURI();

	if (uri == "/hamlib") {
		if (request->getMethod() == "POST") {
			setFrequency(session, request, reply);
		}
		else {
			sendFrequency(session, request, reply);
		}
	}
	else {
		return false;
	}

	return true;
}
// This command is complex because it only allows setting of frequency for channel 1
// This is because only the tilt motor can be controlled by frequency
void onCommandFrequencyOutput()
{
	if (isChannelCorrect(gParameters[0]))
	{
		uint8_t channel = convertToInt(gParameters[0]);
		uint16_t frequency = convertToUint(gParameters[1]);

		if (channel == TILT_CHANNEL)
		{
			if (isReadCommand(gParameters[1]))
			{
				sendInt(currentFrequency);
				sendAck();
			}
			else
			{
				if (!isSafetyOn)
				{
					if (isIntWithinRange(frequency, MOTOR_MIN_FREQUENCY, MOTOR_MAX_FREQUENCY))
					{
						setFrequency(frequency);
						sendAck();
					}
					else
					{
						sendIntRangeError(MOTOR_MIN_FREQUENCY, MOTOR_MAX_FREQUENCY, HERTZ_UNIT);
					}
				}
				else
				{
					Serial.println(F("Cannot change frequency output while safety is on."));
					sendNack();
				}
			}
		}
		else
		{
			Serial.println(F("Changing or reading of frequency only applies to channel 1"));
			sendNack();
		}
	}
	else
	{
		sendChannelError();
	}
}
Beispiel #13
0
void sim_band_cb(GtkWidget *widget, gpointer data) {
  BAND* band;
  BANDSTACK_ENTRY *entry;
fprintf(stderr,"sim_band_cb\n");
  int b=band_get_current();
  if(function) {
    b--;
    if(b<0) {
      b=BANDS-1;
    }
#ifdef LIMESDR
    if(protocol!=LIMESDR_PROTOCOL) {
      if(b==band3400) {
        b=band6;
      }
    }
#endif
  } else {
    b++;
    if(b>=BANDS) {
      b=0;
    }
#ifdef LIMESDR
    if(protocol!=LIMESDR_PROTOCOL) {
      if(b==band70) { 
        b=bandGen;
      }
    }
#endif
  }
  band=band_set_current(b);
  entry=bandstack_entry_get_current();

  setFrequency(entry->frequencyA);
  setMode(entry->mode);
  FILTER* band_filters=filters[entry->mode];
  FILTER* band_filter=&band_filters[entry->filter];
  setFilter(band_filter->low,band_filter->high);

  band=band_get_current_band();
  set_alex_rx_antenna(band->alexRxAntenna);
  set_alex_tx_antenna(band->alexTxAntenna);
  set_alex_attenuation(band->alexAttenuation);
  vfo_update(NULL);
}
Beispiel #14
0
//////////////////////////////////////////////////////////////////////////////
//  Clear the selected digit and the digits below (i.e. set them to 0)
//////////////////////////////////////////////////////////////////////////////
void CFreqCtrl::clearFreq()
{
    if (m_ActiveEditDigit >= 0)
    {
        if (m_DigitInfo[m_ActiveEditDigit].editmode)
        {
            m_freq -= m_DigitInfo[m_ActiveEditDigit].val *
                    m_DigitInfo[m_ActiveEditDigit].incval;

            /* digits below the active one are reset to 0 */
            m_freq -= m_freq % m_DigitInfo[m_ActiveEditDigit].weight;

            setFrequency(m_freq);
            m_LastEditDigit = m_ActiveEditDigit;
        }
    }

}
Beispiel #15
0
//***************************************************************************
void Kwave::PitchShiftPlugin::updateFilter(Kwave::SampleSource *filter,
                                           bool force)
{
    double sr = signalRate();

    if (!filter) return;

    if (!qFuzzyCompare(m_frequency, m_last_freq) || force)
	filter->setAttribute(SLOT(setFrequency(QVariant)),
	    QVariant((m_frequency * 2.0 * M_PI) / sr));

    if (!qFuzzyCompare(m_speed, m_last_speed) || force)
	filter->setAttribute(SLOT(setSpeed(QVariant)),
	    QVariant(m_speed));

    m_last_freq  = m_frequency;
    m_last_speed = m_speed;
}
Beispiel #16
0
//***************************************************************************
void Kwave::NotchFilterPlugin::updateFilter(Kwave::SampleSource *filter,
                                            bool force)
{
    double sr = signalRate();

    if (!filter) return;

    if (!qFuzzyCompare(m_frequency, m_last_freq) || force)
	filter->setAttribute(SLOT(setFrequency(QVariant)),
	    QVariant((m_frequency * 2.0 * M_PI) / sr));

    if (!qFuzzyCompare(m_bw, m_last_bw) || force)
	filter->setAttribute(SLOT(setBandwidth(QVariant)),
	    QVariant((m_bw * 2.0 * M_PI) / sr));

    m_last_freq  = m_frequency;
    m_last_bw    = m_bw;
}
int qtMonitor::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QMainWindow::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: band_160_buttonPressed(); break;
        case 1: band_80_buttonPressed(); break;
        case 2: band_60_buttonPressed(); break;
        case 3: band_40_buttonPressed(); break;
        case 4: band_30_buttonPressed(); break;
        case 5: band_20_buttonPressed(); break;
        case 6: band_17_buttonPressed(); break;
        case 7: band_15_buttonPressed(); break;
        case 8: band_12_buttonPressed(); break;
        case 9: band_10_buttonPressed(); break;
        case 10: band_6_buttonPressed(); break;
        case 11: band_gen_buttonPressed(); break;
        case 12: mode_lsb_buttonPressed(); break;
        case 13: mode_usb_buttonPressed(); break;
        case 14: mode_dsb_buttonPressed(); break;
        case 15: mode_cwl_buttonPressed(); break;
        case 16: mode_cwu_buttonPressed(); break;
        case 17: mode_am_buttonPressed(); break;
        case 18: connect_buttonPressed(); break;
        case 19: socketError((*reinterpret_cast< QAbstractSocket::SocketError(*)>(_a[1]))); break;
        case 20: connected(); break;
        case 21: socketData(); break;
        case 22: update(); break;
        case 23: setMode((*reinterpret_cast< int(*)>(_a[1]))); break;
        case 24: setFilter((*reinterpret_cast< int(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2]))); break;
        case 25: setFrequency((*reinterpret_cast< long long(*)>(_a[1]))); break;
        case 26: moveFrequency((*reinterpret_cast< int(*)>(_a[1]))); break;
        case 27: vfo_dialMoved((*reinterpret_cast< int(*)>(_a[1]))); break;
        case 28: afgain_dialMoved((*reinterpret_cast< int(*)>(_a[1]))); break;
        case 29: setGain((*reinterpret_cast< int(*)>(_a[1]))); break;
        case 30: audioChanged((*reinterpret_cast< int(*)>(_a[1]))); break;
        default: ;
        }
        _id -= 31;
    }
    return _id;
}
Oscillator::Oscillator() : AudioNode() {

	FrequencyIn = new AudioNodeInput(); 
	FMSourceIn = new AudioNodeInput(); 
	FMAmountIn = new AudioNodeInput(); 

	_period = 0;
	_phase = 0;
	_osc = 0;
	_accumulator = 0;
	_sample = 0;

	setFrequency(110.0f);
	setDetune(0.0f);
	setBend(0.0f);
	setPortamento(1);
	setSemitone(0);
	setGain(1.0f);

	// this extends the standard midi frequencies from 128 to 256 discrete values,
	// extending the frequency range with -117 positions below to 0.00949 Hz
	// and +11 above to 23679 Hz.
	for (int i=0; i<=128; i++) {
		_expFrequency[i] = (int64_t(pow(2,((float(i) - 69.0) / 12.0)) * 440.0) << 32) / SAMPLE_RATE;  // divide by sample rate?
		// Serial.print("_expFrequency[");
		// Serial.print(i);
		// Serial.print("] = ");
		// Serial.println(int(_expFrequency[i] >> 32));
	}

	for (int i=0; i<=128; i++) {
		_lfoFrequency[i] = (int64_t(pow(2,((double(i) - 117.0 - 69.0) / 12.0)) * 440.0) << 32) / SAMPLE_RATE;  // divide by sample rate?
	}

	_dir = 1;
	_indx = 0;
	_ifrac = 0;
	_freq0 = 0;
	_freq1 = 0;
	_dfreq = 0;
	_ffrac = 0;
	_dPhase = 0;
	_lfo = false;
}
Beispiel #19
0
ofxSynth::ofxSynth(){

	currentFrequency = startFrequency = targetFrequency = 440;
	
	setFrequency(440);
	currentAmp = 0;
	noteTime = 0;
	usesEnv = false;
	gain = 0.1;
	sustain = 0.5;

	modEnv.setADSR(44100*0.01, 44100*0.2, 0.0, 44100.0*0.1);
	env.setADSR(0.01*44100, 0.1*44100, 0.5, 0.93*44100);
	filter.setup();
	setFilter(0.7, 0.5);
	setFilterLowPass();
	waveMode = 0;
	
}
Beispiel #20
0
VoiceGenerator::VoiceGenerator(const QAudioFormat &format,
                               qreal frequency, qreal amplitude,
                               QObject *parent) :
    QIODevice(parent),
    m_format(format),
    m_amplitude(0.5)
{
    Q_ASSERT(m_format.sampleSize() % 8 == 0);
    int sampleBytes = m_format.channels() * (m_format.sampleSize() / 8);
    // + 1 to round up, just to be sure that all samples fit.
    qint64 samplesInBuffer = m_format.sampleRate()
                             * BufferSizeMilliseconds / 1000 + 1;
    qint64 length = samplesInBuffer * sampleBytes;
    m_buffer.resize(length);
    m_max_position = 0;
    m_position = 0;
    m_amplitude = amplitude;
    setFrequency(frequency);
}
Beispiel #21
0
void CubicSDR::setSampleRate(long long rate_in) {
    sampleRate = rate_in;
    sdrThread->setSampleRate(sampleRate);
    setFrequency(frequency);

    if (rate_in <= CHANNELIZER_RATE_MAX / 8) {
        appframe->setMainWaterfallFFTSize(512);
        appframe->getWaterfallDataThread()->getProcessor()->setHideDC(false);
        spectrumVisualThread->getProcessor()->setHideDC(false);
    } else if (rate_in <= CHANNELIZER_RATE_MAX) {
        appframe->setMainWaterfallFFTSize(1024);
        appframe->getWaterfallDataThread()->getProcessor()->setHideDC(false);
        spectrumVisualThread->getProcessor()->setHideDC(false);
    } else if (rate_in > CHANNELIZER_RATE_MAX) {
        appframe->setMainWaterfallFFTSize(2048);
        appframe->getWaterfallDataThread()->getProcessor()->setHideDC(true);
        spectrumVisualThread->getProcessor()->setHideDC(true);
    }
}
Beispiel #22
0
DueTimer& DueTimer::start(long microseconds){
	/*
		Start the timer
		If a period is set, then sets the period and start the timer
	*/

	if(microseconds > 0)
		setPeriod(microseconds);
	
	if(_frequency[timer] <= 0)
		setFrequency(1);

	NVIC_ClearPendingIRQ(Timers[timer].irq);
	NVIC_EnableIRQ(Timers[timer].irq);
	
	TC_Start(Timers[timer].tc, Timers[timer].channel);

	return *this;
}
Beispiel #23
0
void SPIClass::begin()
{
    pinMode(pinSCK, OUTPUT);
    pinMode(pinMOSI, OUTPUT);
    pinMode(pinMISO, INPUT);

    spi->PSELSCK = pinSCK;
    spi->PSELMOSI = pinMOSI;
    spi->PSELMISO = pinMISO;

	// Default speed set to 4Mhz
	setFrequency(4000);
	setDataMode(SPI_MODE0);
	setBitOrder(MSBFIRST);

    spi->EVENTS_READY = 0;

	spi->ENABLE = (SPI_ENABLE_ENABLE_Enabled << SPI_ENABLE_ENABLE_Pos);
}
Beispiel #24
0
void ProcessCallingMessage(int Channel, char *Message)
{
	char Payload[16];
	double Frequency;
	int ImplicitOrExplicit, ErrorCoding, Bandwidth, SpreadingFactor, LowDataRateOptimize;
	
	ChannelPrintf(Channel, 4, 1, "Calling message %d bytes ", strlen(Message));
													
	if (sscanf(Message+2, "%15[^,],%lf,%d,%d,%d,%d,%d,%*d",
						Payload,
						&Frequency,
						&ImplicitOrExplicit,
						&ErrorCoding,
						&Bandwidth,
						&SpreadingFactor,
						&LowDataRateOptimize) == 7)
	{
		if (Config.LoRaDevices[Channel].AFC)
		{
			double MasterFrequency;
			
			sscanf(Config.LoRaDevices[Channel].Frequency, "%lf", &MasterFrequency);
		
			Frequency += Config.LoRaDevices[Channel].activeFreq - MasterFrequency;
		}
		
		LogMessage("Ch %d: Calling message, new frequency %7.3lf\n", Channel, Frequency);
		
		// Decoded OK
		setMode(Channel, RF96_MODE_SLEEP);
		
		// setFrequency(Channel, Config.LoRaDevices[Channel].activeFreq + );
		setFrequency(Channel, Frequency);

		SetLoRaParameters(Channel, ImplicitOrExplicit, ErrorCoding, Bandwidth, SpreadingFactor, LowDataRateOptimize);
		
		setMode(Channel, RF96_MODE_RX_CONTINUOUS); 
		
		Config.LoRaDevices[Channel].InCallingMode = 1;
		
		// ChannelPrintf(Channel, 1, 1, "Channel %d %7.3lfMHz              ", Channel, Frequency);
	}
}
Beispiel #25
0
/*
Enables all the trackers and sets the streaming frequency.
Note: Trackers according to VRPN and Trackers as defined by OWL
are two entirely different things.
*/
bool vrpn_Tracker_PhaseSpace::enableTracker(bool enable)
{
#ifdef DEBUG
  printf("%s %d\n", __PRETTY_FUNCTION__, enable);
#endif

  if(!owlRunning) return false;

  // Scale the reports for this tracker to be in meters rather than
  // in MM, to match the VRPN standard.
  owlScale(MM_TO_METERS);

  if(!slave) {
    int option = enable ? OWL_ENABLE : OWL_DISABLE;
    owlTracker(0,option); //enables/disables the point tracker
    if(!owlGetStatus())
      return false;

    //enable/disable the rigid trackers
    for(int i = 1; i <= numRigids; i++) {
      owlTracker(i,option);
      if(!owlGetStatus())
        return false;
    }
  }

  if(enable) {
    setFrequency(frequency);
    owlSetInteger(OWL_EVENTS, OWL_ENABLE);
    owlSetInteger(OWL_STREAMING,OWL_ENABLE);
    if(!owlGetStatus())
      return false;
    printf("Streaming enabled.\n");
  } else {
    owlSetInteger(OWL_EVENTS, OWL_DISABLE);
    owlSetInteger(OWL_STREAMING,OWL_DISABLE);
    if(!owlGetStatus())
      return false;
    printf("Streaming disabled.\n");
  }
  return true;
}
Beispiel #26
0
int testFrequency() {
	int result = PASS;
	int hvox = voiceFactory(60, 64, ZEROBIAS, RATE);
	float freq;
	int hz;
	int voxFreq;
	/* look inside the box */
	for (freq = 60; freq < 3200; freq *= 1.1) {
		hz = (int) freq;
		setFrequency(hvox, hz, RATE);
		voxFreq = getFrequency(hvox, RATE);
		if (abs(hz - voxFreq) > 20) result = FAIL;
		printf("Test frequency: %i", hz);
		printf("\tVoice Frequency: %i", voxFreq);
		printf("\n");
	}

	freeVoice(hvox);
	return result;
}
Beispiel #27
0
WirelessAccessPoint::WirelessAccessPoint(const QDBusObjectPath &objectPath, QObject *parent) :
    QObject(parent),
    m_objectPath(objectPath),
    m_securityFlags(0)
{
    QDBusInterface accessPointInterface(serviceString, m_objectPath.path(), accessPointInterfaceString, QDBusConnection::systemBus());
    if(!accessPointInterface.isValid()) {
        qCWarning(dcNetworkManager()) << "Invalid access point dbus interface";
        return;
    }

    // Init properties
    setSsid(accessPointInterface.property("Ssid").toString());
    setMacAddress(accessPointInterface.property("HwAddress").toString());
    setFrequency(accessPointInterface.property("Frequency").toDouble() / 1000);
    setSignalStrength(accessPointInterface.property("Strength").toUInt());
    setSecurityFlags(WirelessAccessPoint::ApSecurityModes(accessPointInterface.property("WpaFlags").toUInt()));
    setIsProtected((bool)accessPointInterface.property("Flags").toUInt());

    QDBusConnection::systemBus().connect(serviceString, objectPath.path(), accessPointInterfaceString, "PropertiesChanged", this, SLOT(onPropertiesChanged(QVariantMap)));
}
Beispiel #28
0
void LogVariablesWidget::loadSettings(QSettings &pSettings)
{
    pSettings.beginGroup("logVariablesWidget");
    restoreGeometry( pSettings.value("geometry").toByteArray() );
    setVisible( pSettings.value("visible").toBool() );

    for ( int i = 0; i < ui->logVariableTable->rowCount(); ++i )
    {
        if ( pSettings.childGroups().contains(ui->logVariableTable->item(i, 0)->text()) )
        {
            pSettings.beginGroup(ui->logVariableTable->item(i, 0)->text());
			setLogVariableChecked( i, true );
			setFrequency(i, pSettings.value("frequency", DataRepository::instance()->frequency()).toDouble());
			setStartTime(i, pSettings.value("startTime", 0).toDouble());
			setDuration(i, pSettings.value("duration", DataRepository::instance()->duration()).toDouble());
            pSettings.endGroup();
        }
    }

    pSettings.endGroup();
}
void RecurrenceWidget::set(bool recurring, int frequency, QString period, QDateTime start, QDateTime end, int max)
{
  if (DEBUG)
    qDebug() << objectName() << "::set(" << recurring << ", "
             << frequency    << ", "     << period    << ", "
             << start        << ", "     << end       << ", "
             << max          << ") entered";
  setRecurring(recurring);
  setPeriod(period);
  setFrequency(frequency);
  setStartDateTime(start);
  setEndDateTime(end);
  setMax(max);

  _prevEndDateTime   = end.isValid() ? end : _eot ;
  _prevFrequency     = frequency;
  _prevPeriod        = stringToPeriod(period);
  _prevRecurring     = recurring;
  _prevStartDateTime = start;
  _prevMax           = max;
}
Beispiel #30
0
GtkWidget* vfo_init(int width,int height,GtkWidget *parent) {

fprintf(stderr,"vfo_init: width=%d height=%d\n", width, height);
  parent_window=parent;
  my_width=width;
  my_height=height;

  vfo = gtk_drawing_area_new ();
  gtk_widget_set_size_request (vfo, width, height);

  /* Signals used to handle the backing surface */
  g_signal_connect (vfo, "draw",
            G_CALLBACK (vfo_draw_cb), NULL);
  g_signal_connect (vfo,"configure-event",
            G_CALLBACK (vfo_configure_event_cb), NULL);

  /* Event signals */
  g_signal_connect (vfo, "button-press-event",
            G_CALLBACK (vfo_press_event_cb), NULL);
  g_signal_connect(vfo,"scroll_event",
            G_CALLBACK(vfo_scroll_event_cb),NULL);
  gtk_widget_set_events (vfo, gtk_widget_get_events (vfo)
                     | GDK_BUTTON_PRESS_MASK
                     | GDK_SCROLL_MASK);

fprintf(stderr,"vfo_init: set Frequency,Mode,Filter\n");
  BAND *band=band_get_current_band();
  BANDSTACK_ENTRY* entry=bandstack_entry_get_current();
  setFrequency(entry->frequencyA);
  setMode(entry->mode);
  FILTER* band_filters=filters[entry->mode];
  FILTER* band_filter=&band_filters[entry->filter];
  setFilter(band_filter->low,band_filter->high);

  set_alex_rx_antenna(band->alexRxAntenna);
  set_alex_tx_antenna(band->alexTxAntenna);
  set_alex_attenuation(band->alexAttenuation);

  return vfo;
}