本文整理汇总了C++中setFrequency函数的典型用法代码示例。如果您正苦于以下问题:C++ setFrequency函数的具体用法?C++ setFrequency怎么用?C++ setFrequency使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了setFrequency函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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());
}
}
示例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 );
}
}
示例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);
}
示例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);
}
}
示例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;
}
示例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;
}
示例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;
}
}
}
示例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);
}
}
示例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);
}
示例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 );
}
示例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;
}
示例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();
}
}
示例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);
}
示例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;
}
}
}
示例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;
}