• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ setFrequency函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中setFrequency函数的典型用法代码示例。如果您正苦于以下问题:C++ setFrequency函数的具体用法?C++ setFrequency怎么用?C++ setFrequency使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了setFrequency函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: setFrequency

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());
    }
}
开发者ID:emreaslan,项目名称:zenom,代码行数:15,代码来源:logvariableswidget.cpp


示例2: if

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 );
    }
}
开发者ID:ErNancy,项目名称:kosm,代码行数:36,代码来源:synthevent.cpp


示例3: sim_bandstack_cb

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);
}
开发者ID:pa3gsb,项目名称:RadioBerry,代码行数:15,代码来源:toolbar.c


示例4: setFrequency

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);
    }
}
开发者ID:george-viaud,项目名称:CubicSDR,代码行数:48,代码来源:CubicSDR.cpp


示例5: while

/* 
 * 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;
}
开发者ID:sumitbirla,项目名称:carpc,代码行数:55,代码来源:radiowidget.cpp


示例6: read8

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;
}
开发者ID:hl68fx,项目名称:ParticleVCNL4010,代码行数:16,代码来源:VCNL4010.cpp


示例7: setFrequency

//////////////////////////////////////////////////////////////////////////////
//  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;
        }
    }
}
开发者ID:aosmith,项目名称:gqrx,代码行数:19,代码来源:freqctrl.cpp


示例8: setLoRaMode

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);
	}
}
开发者ID:zhanwwan,项目名称:lora-gateway,代码行数:16,代码来源:gateway.c


示例9: wsMessageReceived

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);
}
开发者ID:avtehnik,项目名称:esp8266-music-box,代码行数:47,代码来源:application.cpp


示例10: Brass

// 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 );
}
开发者ID:CLOUDS-Interactive-Documentary,项目名称:RTCmix,代码行数:19,代码来源:Brass.cpp


示例11: setFrequency

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;
}
开发者ID:hanzz,项目名称:hamlog,代码行数:17,代码来源:hamlib.cpp


示例12: onCommandFrequencyOutput

// 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();
	}
}
开发者ID:aftabn,项目名称:HelicopterController,代码行数:48,代码来源:commandHandlers.cpp


示例13: sim_band_cb

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);
}
开发者ID:pa3gsb,项目名称:RadioBerry,代码行数:45,代码来源:toolbar.c


示例14: setFrequency

//////////////////////////////////////////////////////////////////////////////
//  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;
        }
    }

}
开发者ID:badcure,项目名称:gqrx,代码行数:21,代码来源:freqctrl.cpp


示例15: signalRate

//***************************************************************************
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;
}
开发者ID:KDE,项目名称:kwave,代码行数:19,代码来源:PitchShiftPlugin.cpp


示例16: signalRate

//***************************************************************************
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;
}
开发者ID:KDE,项目名称:kwave,代码行数:19,代码来源:NotchFilterPlugin.cpp


示例17: switch

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;
}
开发者ID:8cH9azbsFifZ,项目名称:ghpsdr3-alex,代码行数:44,代码来源:moc_qtMonitor.cpp


示例18: AudioNode

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;
}
开发者ID:VSIONHAIRIES,项目名称:CHEAP-FAT-OPEN,代码行数:44,代码来源:Oscillator.cpp


示例19: setFrequency

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;
	
}
开发者ID:dals,项目名称:openFrameworks,代码行数:19,代码来源:ofxSynth.cpp


示例20: QIODevice

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);
}
开发者ID:Afreeca,项目名称:qt,代码行数:19,代码来源:voicegenerator.cpp



注:本文中的setFrequency函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ setFunction函数代码示例发布时间:2022-05-30
下一篇:
C++ setFrameShape函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap