// --------------------------------------------------------------------------- void CUARFCN::ReadConf(ini_t *pini) { pini->Select("BNDS"); m_bBandEnable[0] = pini->Get("I", 1); m_bBandEnable[1] = pini->Get("II", 1); m_bBandEnable[2] = pini->Get("III", 1); m_bBandEnable[3] = pini->Get("IV", 1); m_bBandEnable[4] = pini->Get("V", 1); m_bBandEnable[5] = pini->Get("VI", 1); m_bBandEnable[6] = pini->Get("VII", 1); m_bBandEnable[7] = pini->Get("VIII", 1); m_bBandEnable[8] = pini->Get("IX", 1); m_bBandEnable[9] = pini->Get("X", 1); m_bBandEnable[10] = pini->Get("XI", 1); m_bBandEnable[11] = pini->Get("XII", 1); m_bBandEnable[12] = pini->Get("XIII", 1); m_bBandEnable[13] = pini->Get("XIV", 1); SetBands(true); // ULRX SetBands(false); // DLTX SetChannels(true); // ULRX SetChannels(false); // DLTX SetFrequency(true); // ULRX SetFrequency(false); // DLTX };
void testWithinLimitsPasses(void) { SetFrequency(MAX_FREQ); TEST_ASSERT_EQUAL(MAX_FREQ, GetFrequency()); SetFrequency(MIN_FREQ); TEST_ASSERT_EQUAL(MIN_FREQ, GetFrequency()); }
//Generate the height map and stash void Chunk::generateData() { auto mountain = new noise::module::RidgedMulti(); mountain->SetOctaveCount(20); mountain->SetFrequency(0.2); auto baseFlat = new noise::module::Billow(); baseFlat->SetOctaveCount(20); auto flatTerrain = new noise::module::ScaleBias(); flatTerrain->SetSourceModule(0, *baseFlat); flatTerrain->SetScale(0.125); flatTerrain->SetBias(-0.96); //Perlin to control which type of terrain to generate auto terrainType = new noise::module::Perlin(); terrainType->SetOctaveCount(4); terrainType->SetFrequency(0.5); terrainType->SetPersistence(0.25); auto select = new noise::module::Select(); m_noiseModule = select; select->SetSourceModule(0, *flatTerrain); select->SetSourceModule(1, *mountain); select->SetControlModule(*terrainType); select->SetBounds(0.0, 1000.0); select->SetEdgeFalloff(0.6); m_modules.push_back(mountain); m_modules.push_back(baseFlat); m_modules.push_back(flatTerrain); m_modules.push_back(terrainType); }
void CUARFCN::Initialize() { SetBands(true); // ULRX SetBands(false); // DLTX SetChannels(true); // ULRX SetChannels(false); // DLTX SetFrequency(true); // ULRX SetFrequency(false); // DLTX };
void testRPMFollowsFrequency(void) { const STROBESETTINGS * rtn; rtn = SetFrequency(MIN_FREQ); TEST_ASSERT_EQUAL((MIN_FREQ*60)/1000, rtn->rpm); rtn = SetFrequency(5000); TEST_ASSERT_EQUAL((5000*60)/1000, rtn->rpm); rtn = SetFrequency(MAX_FREQ); TEST_ASSERT_EQUAL((MAX_FREQ*60)/1000, rtn->rpm); }
void TNote::Slide(TNote aNote) { int i, n = 0; int FromFrequency, ToFrequency; if (GetFrequency() < aNote.GetFrequency()) { FromFrequency = GetFrequency(); ToFrequency = aNote.GetFrequency(); } else { FromFrequency = aNote.GetFrequency(); ToFrequency = GetFrequency(); } Duration = Duration / 5; for (i = FromFrequency; i <= ToFrequency; i = i + (ToFrequency - FromFrequency) / 5) { SetFrequency(i); PrintParameters(0, 0, 0); std::cout << n << ' '; n++; Play(); } Duration = Duration * 5; }
void SoundSource::Play(Sound* sound, float frequency, float gain, float panning) { SetFrequency(frequency); SetGain(gain); SetPanning(panning); Play(sound); }
void OGNRadio::SendPacket(uint8_t *Packet, uint16_t Size, uint16_t Freq, uint8_t TxPower) { uint8_t i; SetTxPower(TxPower); SetFrequency(Freq); WriteRegister(REG_PAYLOADLENGTH, Size); WriteRegister(REG_SYNCCONFIG,RF_SYNC_OFF); WriteRegister(REG_PREAMBLEMSB, 0x00); WriteRegister(REG_PREAMBLELSB, 0x80); ClearIRQFlags(); for(i=0;i<Size;i++) { WriteRegister(REG_FIFO,Packet[i]); } WriteRegister(REG_OPMODE , RF_DATAMODUL_MODULATIONTYPE_FSK | RF_OPMODE_LISTEN_OFF | RF_OPMODE_TRANSMITTER); do {} while( (ReadRegister(REG_IRQFLAGS2) & RF_IRQFLAGS2_PACKETSENT ) != RF_IRQFLAGS2_PACKETSENT); WriteRegister(REG_OPMODE, RF_DATAMODUL_MODULATIONTYPE_FSK | RF_OPMODE_LISTEN_OFF | RF_OPMODE_STANDBY); }
void OGNRadio::StartReceive(uint8_t Freq, uint8_t *Sync) { uint8_t i; uint8_t SyncValueRegister = REG_SYNCVALUE1; SetTxPower(0); SetFrequency(Freq); for(i=0;i<8;i++) { WriteRegister(SyncValueRegister++,Sync[i]); } WriteRegister(REG_SYNCCONFIG,RF_SYNC_ON | RF_SYNC_SIZE_8 | RF_SYNC_TOL_0); WriteRegister(REG_PAYLOADLENGTH, 56); WriteRegister(REG_LNA,RF_LNA_ZIN_50 | RF_LNA_GAINSELECT_AUTO | RF_LNA_LOWPOWER_OFF | RF_LNA_CURRENTGAIN ); WriteRegister(REG_RXBW,RF_RXBW_DCCFREQ_101 | RF_RXBW_MANT_20 | RF_RXBW_EXP_2); WriteRegister(REG_AFCBW,RF_AFCBW_DCCFREQAFC_100 | RF_AFCBW_MANTAFC_20 | RF_AFCBW_EXPAFC_2); WriteRegister(REG_AFCCTRL,RF_AFCCTRL_LOWBETA_ON); WriteRegister(REG_AFCFEI,RF_AFCFEI_AFCAUTO_ON); WriteRegister(REG_RSSITHRESH, 220); WriteRegister(REG_TESTLNA,RF_TESTLNA_HIGH_SENSITIVITY); WriteRegister(REG_TESTDAGC,RF_DAGC_IMPROVED_LOWBETA0); WriteRegister(REG_AFCFEI,RF_AFCFEI_AFCAUTOCLEAR_OFF); ClearIRQFlags(); WriteRegister(REG_OPMODE , RF_DATAMODUL_MODULATIONTYPE_FSK | RF_OPMODE_LISTEN_OFF | RF_OPMODE_RECEIVER); }
void PositionMessageSenderSystem::Init() { MessageSenderSystem::Init(); SetFrequency( 10 ); // mSendPositions.insert(platform::AutoId("player")); // mSendPositions.insert(platform::AutoId("spider1")); if ( mProgramState.mMode == ProgramState::Server ) { mActorFrequencyTimerHolder.Add( ActorFrequencyTimer( 600.0, platform::AutoId( "spider1" ) ) ); mActorFrequencyTimerHolder.Add( ActorFrequencyTimer( 600.0, platform::AutoId( "spider2" ) ) ); mActorFrequencyTimerHolder.Add( ActorFrequencyTimer( 300.0, platform::AutoId( "spider1target" ) ) ); mActorFrequencyTimerHolder.Add( ActorFrequencyTimer( 300.0, platform::AutoId( "spider2target" ) ) ); mActorFrequencyTimerHolder.Add( ActorFrequencyTimer( 300.0, platform::AutoId( "player" ) ) ); mActorFrequencyTimerHolder.Add( ActorFrequencyTimer( 300.0, platform::AutoId( "ctf_player" ) ) ); mActorFrequencyTimerHolder.Add( ActorFrequencyTimer( 1000.0, platform::AutoId( "flag" ) ) ); mActorFrequencyTimerHolder.Add( ActorFrequencyTimer( 100.0, platform::AutoId( "grenade_projectile" ) ) ); mActorFrequencyTimerHolder.Add( ActorFrequencyTimer( 100.0, platform::AutoId( "blue_grenade_projectile" ) ) ); mActorFrequencyTimerHolder.Add( ActorFrequencyTimer( 100.0, platform::AutoId( "rocket_launcher_target_projectile" ) ) ); mActorFrequencyTimerHolder.Add( ActorFrequencyTimer( 100.0, platform::AutoId( "rusty_reaper_projectile" ) ) ); } else if ( mProgramState.mMode == ProgramState::Client ) { mActorFrequencyTimerHolder.Add( ActorFrequencyTimer( 0.0, platform::AutoId( "player" ) ) ); mActorFrequencyTimerHolder.Add( ActorFrequencyTimer( 0.0, platform::AutoId( "ctf_player" ) ) ); } }
////////////////////////////////////////////////////////////////////////////// // Decrement the digit active in edit mode ////////////////////////////////////////////////////////////////////////////// void CFreqCtrl::DecDigit() { int tmp; qint64 tmpl; if( m_ActiveEditDigit>=0) { if( m_DigitInfo[m_ActiveEditDigit].editmode) { if(m_DigitInfo[m_ActiveEditDigit].weight == m_DigitInfo[m_ActiveEditDigit].incval) { // get the current digit value tmp = (int)((m_freq/m_DigitInfo[m_ActiveEditDigit].weight)%10); // set the current digit value to zero m_freq -= tmp*m_DigitInfo[m_ActiveEditDigit].weight; tmp--; if( tmp<0 ) tmp = 9; m_freq = m_freq+(qint64)tmp*m_DigitInfo[m_ActiveEditDigit].weight; } else { tmp = (int)((m_freq/m_DigitInfo[m_ActiveEditDigit+1].weight)%10); tmpl = m_freq - m_DigitInfo[m_ActiveEditDigit].incval; if(tmp != (int)((tmpl/m_DigitInfo[m_ActiveEditDigit+1].weight)%10) ) { tmpl += m_DigitInfo[m_ActiveEditDigit+1].weight; } m_freq = tmpl; } SetFrequency(m_freq); } } }
void CShake::KeyValue( KeyValueData *pkvd ) { if (FStrEq(pkvd->szKeyName, "amplitude")) { SetAmplitude( atof(pkvd->szValue) ); pkvd->fHandled = TRUE; } else if (FStrEq(pkvd->szKeyName, "frequency")) { SetFrequency( atof(pkvd->szValue) ); pkvd->fHandled = TRUE; } else if (FStrEq(pkvd->szKeyName, "duration")) { SetDuration( atof(pkvd->szValue) ); pkvd->fHandled = TRUE; } else if (FStrEq(pkvd->szKeyName, "radius")) { SetRadius( atof(pkvd->szValue) ); pkvd->fHandled = TRUE; } else CPointEntity::KeyValue( pkvd ); }
void SoundSource::Play(SoundStream* stream) { if (!audio_) return; // If no frequency set yet, set from the stream's default if (frequency_ == 0.0f && stream) SetFrequency(stream->GetFrequency()); SharedPtr<SoundStream> streamPtr(stream); // If sound source is currently playing, have to lock the audio mutex. When stream playback is explicitly // requested, clear the existing sound if any if (position_) { MutexLock lock(audio_->GetMutex()); sound_.Reset(); PlayLockless(streamPtr); } else { sound_.Reset(); PlayLockless(streamPtr); } // Stream playback is not supported for network replication, no need to mark network dirty }
void SoundSource::Play(Sound* sound) { if (!audio_) return; // If no frequency set yet, set from the sound's default if (frequency_ == 0.0f && sound) SetFrequency(sound->GetFrequency()); // If sound source is currently playing, have to lock the audio mutex if (position_) { MutexLock lock(audio_->GetMutex()); PlayLockless(sound); } else PlayLockless(sound); // Forget the Sound & Is Playing attribute previous values so that they will be sent again, triggering // the sound correctly on network clients even after the initial playback if (networkState_ && networkState_->attributes_ && networkState_->previousValues_.size()) { for (unsigned i = 1; i < networkState_->previousValues_.size(); ++i) { // The indexing is different for SoundSource & SoundSource3D, as SoundSource3D removes two attributes, // so go by attribute types VariantType type = networkState_->attributes_->at(i).type_; if (type == VAR_RESOURCEREF || type == VAR_BOOL) networkState_->previousValues_[i] = Variant::EMPTY; } } MarkNetworkUpdate(); }
static void AVTunerMethodFunc( void *ctx, ComaMethodID method, void *arg, unsigned int magic ) { int ret; AVTuner *tuner = ctx; IComaComponent *component = tuner->component; switch (method) { case AV_TUNER_SETFREQUENCY: ret = SetFrequency( ctx, arg ); break; case AV_TUNER_SETGAINS: ret = SetGains( ctx, arg ); break; default: ret = DR_NOIMPL; break; } component->Return( component, ret, magic ); }
TNote::TNote(TKey aKey, TOctave aOctave) { Key = aKey; Octave = aOctave; int SemitonesNumber = KEYS_COUNT * (aOctave - FIRST_OCTAVE) + (aKey - A); float Frequency = FREQUENCY_A4 * pow(2, (float)SemitonesNumber / KEYS_COUNT); SetFrequency(Frequency); }
void VHTTPServerLogBackupSettings::ResetToFactorySettings() { SetLogRotationMode (LRC_ROTATE_ON_FILE_SIZE); SetLogMaxSize (HTTP_SERVER_LOG_DEFAULT_SIZE); SetFrequency (0); SetStartingTime (0); fDaysHours.clear(); }
void RotateMessageSenderSystem::Init() { MessageSenderSystem::Init(); SetFrequency( 10 ); if (mProgramState.mMode == ProgramState::Server) { mActorFrequencyTimerHolder.Add( ActorFrequencyTimer( 0.0, platform::AutoId( "rusty_reaper_alt_projectile" ) ) ); } }
//========================================================================== // Class: PWMOutput // Function: PWMOutput // // Description: Constructor for PWMOutput class. // // Input Arguments: // pin = int, represents hardware pin number according to Wiring Pi // mode = PWMMode, indicating the style of PWM phasing to use // // Output Arguments: // None // // Return Value: // None // //========================================================================== PWMOutput::PWMOutput(int pin, PWMMode mode) : GPIO(pin, DirectionPWMOutput) { SetDutyCycle(0.0); SetMode(mode); range = 1024; // Set the frequency using the member method just in case something // outside of the class manipulated it before-hand. SetFrequency(pwmClockFrequency / range / minClockDivisor); }
void cTMS9919::WriteData ( Uint8 data ) { // FUNCTION_ENTRY ( this, "cTMS9919::WriteData", true ); if ( m_LastData & 0xFF00 ) { // Handle Generator & Frequency int tone = ( m_LastData & 0x60 ) >> 5; int div = (( data & 0x3F ) << 4 ) | ( m_LastData & 0x0F ); if ( div != 0 ) { SetFrequency ( tone, ( int ) ( m_clock_frequency / ( div * 32 ))); } m_LastData = 0; } else {
VHTTPServerLogBackupSettings& VHTTPServerLogBackupSettings::operator = (const VHTTPServerLogBackupSettings& inValue) { if (&inValue != this) { SetLogRotationMode (inValue.fLogRotationMode); SetLogMaxSize (inValue.fLogMaxSize); SetFrequency (inValue.fFrequency); SetStartingTime (inValue.fStartingTime); SetDaysHoursMap (inValue.fDaysHours); } return *this; }
////////////////////////////////////////////////////////////////////////////// // Decrement the frequency by this digit active in edit mode ////////////////////////////////////////////////////////////////////////////// void CFreqCtrl::DecFreq() { if( m_ActiveEditDigit>=0) { if( m_DigitInfo[m_ActiveEditDigit].editmode) { m_freq -= m_DigitInfo[m_ActiveEditDigit].incval; m_freq = m_freq - m_freq%m_DigitInfo[m_ActiveEditDigit].weight; SetFrequency(m_freq); m_LastEditDigit = m_ActiveEditDigit; } } }
void testHalfFrequencyDivisionIsCorrect(void) { const STROBESETTINGS * rtn; MILLIHZ expected = (MAX_FREQ+1)/2; SetFrequency(MAX_FREQ); while (expected > MIN_FREQ) { rtn = HalfFrequency(); TEST_ASSERT_EQUAL(expected, rtn->frequency); expected = (expected + 1) / 2; } }
void testThirdFrequencyDivisionIsCorrect(void) { const STROBESETTINGS * rtn; MILLIHZ expected = ((MAX_FREQ*2) + 3) / 6; SetFrequency(MAX_FREQ); while (expected > MIN_FREQ) { rtn = ThirdFrequency(); TEST_ASSERT_EQUAL(expected, rtn->frequency); expected = ((expected * 2) + 3) / 6; } }
void testTrebleFrequencyIsCorrect(void) { const STROBESETTINGS * rtn; MILLIHZ expected = MIN_FREQ * 3; SetFrequency(MIN_FREQ); while (expected < MAX_FREQ) { rtn = TrebleFrequency(); TEST_ASSERT_EQUAL(expected, rtn->frequency); expected *= 3; } }
double CUARFCN::selectChannel(bool ULRX, int ChanInd) { double dFreq; SelectionContainer *Channels; if (ULRX) Channels = &cmbULRXChan; else Channels = &cmbDLTXChan; if (Channels == NULL) return 0; Channels->itemIndex = ChanInd; dFreq = SetFrequency(ULRX); return dFreq; }
////////////////////////////////////////////////////////////////////////////// // 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; } } }
// ----------------------------------------------------------------------------- // CRadioServerSettings::SetRdsEndAF // ----------------------------------------------------------------------------- // void CRadioServerSettings::SetRdsEndAF( TInt aError, TInt aFrequency ) { TPckgBuf<TRsSettingsData> afData; afData().iError = aError; afData().iData1 = aFrequency; RProperty::Set(KRadioServerPropertyCategory, ERadioServPsAfSearchEnd, afData); if (aError == KErrNone) { SetFrequency(aFrequency); } }
/** * This method set the frequency to the specified value, waits up to usTimeout * microseconds for lock (in increments of us microseconds). * * The return value is the actual frequency set or 0 on error or timeout. */ int64_t Adf4351::SetFrequencyWithLock( int64_t freqHz, int dus, int usTimeout ) { int us; freqHz = SetFrequency( freqHz ); us = 0; while( !GetLock() ){ us_sleep(dus); us += dus; if( us>usTimeout ){ return(0); } } return(freqHz); }
void JukeBox::Init() { const Config* cfg = Config::GetConstInstance(); ActiveMusic(cfg->GetSoundMusic()); SetFrequency(cfg->GetSoundFrequency()); if (!OpenDevice()) { End(); return; } Mix_ChannelFinished(JukeBox::EndChunk); Mix_HookMusicFinished(JukeBox::EndMusic); LoadXML("default"); LoadMusicXML(); }