//--------------------------------------------------------- void CrolPlayer::SetNotePercussive(int const voice, int const note) { int const channel_bit_mask = 1 << (4-voice+kBassDrumChannel); mAMVibRhythmCache &= ~channel_bit_mask; opl->write(skOPL2_AmVibRhythmBaseAddress, mAMVibRhythmCache); mKeyOnCache[voice] = false; if (note != kSilenceNote) { switch(voice) { case kTomtomChannel: SetFreq(kTomtomChannel, note); SetFreq(kSnareDrumChannel, note + kTomTomToSnare); break; case kBassDrumChannel: SetFreq(voice, note); break; default: // Does nothing break; } mKeyOnCache[voice] = true; mAMVibRhythmCache |= channel_bit_mask; opl->write(skOPL2_AmVibRhythmBaseAddress, mAMVibRhythmCache); } }
bool DspOscillator::ParameterUpdating_(int index, DspParameter const& param) { if (index == pBufferSize) { SetBufferSize(*param.GetInt()); return true; } else if (index == pSampleRate) { SetSampleRate(*param.GetInt()); return true; } else if (index == pAmplitude) { SetAmpl(*param.GetFloat()); return true; } else if (index == pFrequency) { SetFreq(*param.GetFloat()); return true; } return false; }
void GasTank::Close() { GetChat().PostSimpleText(name + " is closed", owner.ret_id()); open_ = false; SetFreq(0); }
void GasTank::Open() { GetChat().PostSimpleText(name + " is open", owner.ret_id()); open_ = true; SetFreq(1); }
PWM::PWM(PORT_t *psPort, TC0_t *psTimerCounter, uint8_t unPinPosition, PORT_OPC_enum ePinOPC, uint32_t unCpuFrequency, uint32_t unPwmFrequency) { m_psTimerCounter = psTimerCounter; m_unPinPosition = unPinPosition; /* Set Frequency */ SetFreq(unCpuFrequency,unPwmFrequency); /* Set pin as output and low */ psPort->OUTCLR = 1<<m_unPinPosition; psPort->DIRSET = 1<<m_unPinPosition; /* Set Output and Pull configuration*/ if (m_unPinPosition == PIN0_bp) {psPort->PIN0CTRL = ePinOPC;} else if (m_unPinPosition == PIN1_bp) {psPort->PIN1CTRL = ePinOPC;} else if (m_unPinPosition == PIN2_bp) {psPort->PIN2CTRL = ePinOPC;} else if (m_unPinPosition == PIN3_bp) {psPort->PIN3CTRL = ePinOPC;} else if (m_unPinPosition == PIN4_bp) {psPort->PIN4CTRL = ePinOPC; m_unPinPosition = PIN0_bp;} else if (m_unPinPosition == PIN5_bp) {psPort->PIN5CTRL = ePinOPC; m_unPinPosition = PIN1_bp;} /* Single slope PWM mode */ m_psTimerCounter->CTRLB |= 0<<TC0_WGMODE2_bp|1<<TC0_WGMODE1_bp|1<<TC0_WGMODE0_bp; /* Default is PWM stopped */ Stop(); }
// //constructor // CSysTick::CSysTick() { SysTick_CLKSourceConfig(SysTick_CLKSource_HCLK_Div8); //9MHz stop(); reset(); SetFreq(10); //default frequence 1kHz }
void CSubtractiveInstrument::SetNote(CNote *note) { // Get a list of all attribute nodes and the // length of that list CComPtr<IXMLDOMNamedNodeMap> attributes; note->Node()->get_attributes(&attributes); long len; attributes->get_length(&len); StringToWaveform(note->Waveform()); // Loop over the list of attributes for (int i = 0; i < len; i++) { // Get attribute i CComPtr<IXMLDOMNode> attrib; attributes->get_item(i, &attrib); // Get the name of the attribute CComBSTR name; attrib->get_nodeName(&name); // Get the value of the attribute. A CComVariant is a variable // that can have any type. It loads the attribute value as a // string (UNICODE), but we can then change it to an integer // (VT_I4) or double (VT_R8) using the ChangeType function // and then read its integer or double value from a member variable. CComVariant value; attrib->get_nodeValue(&value); if (name == "duration") { value.ChangeType(VT_R8); // number of beats * seconds per beat = seconds for note SetDuration(value.dblVal); } else if (name == "note") { SetFreq(NoteToFrequency(value.bstrVal)); } if (name == "resonfrequency") { mResonFilter = true; value.ChangeType(VT_R8); mResonFrequency = value.dblVal; } // if (name == "resonbandwidth") // { // value.ChangeType(VT_R8); // mResonBandwidth = value.dblVal; // } // // if (name == "filter-envelope") // { // mFilterEnvelope = true; // } } }
void Door::process() { if (door_state_ == OPENING) { if (MAIN_TICK - last_tick_ > 11) { door_state_ = OPEN; SetPassable(D_ALL, Passable::FULL); last_tick_ = MAIN_TICK; SetState("door_open"); } return; } if (door_state_ == CLOSING) { if (MAIN_TICK - last_tick_ > 11) { door_state_ = CLOSED; last_tick_ = MAIN_TICK; SetState("door_closed"); SetFreq(0); } return; } if (door_state_ == OPEN) if (MAIN_TICK - last_tick_ > 50) Close(); }
void GlassDoor::process() { if (door_state_ == OPENING) { if (MAIN_TICK - last_tick_ > 9) { door_state_ = OPEN; SetPassable(GetDir(), Passable::FULL); last_tick_ = MAIN_TICK; SetState(door_prefix_ + "open"); } return; } if (door_state_ == CLOSING) { if (MAIN_TICK - last_tick_ > 9) { door_state_ = CLOSED; last_tick_ = MAIN_TICK; SetState(door_prefix_); SetFreq(0); } return; } if (door_state_ == OPEN) if (MAIN_TICK - last_tick_ > 50) Close(); }
bool libname::COggStreamSample::Load( const char *szFilename ) { vorbis_info * pInfo; if ( !m_pFile ) m_pFile = fopen( szFilename, "rb"); if( ov_open_callbacks( m_pFile , &m_OggFile, NULL, 0, OV_CALLBACKS_DEFAULT) < 0) { cerr << "Input does not appear to be an Ogg bitstream." << endl; return false; } pInfo = ov_info(&m_OggFile,-1); SetNumChannels( pInfo->channels); // number of channels SetFreq( pInfo->rate); // The frequency of the sampling rate // Check the number of channels... always use 16-bit samples if (GetNumChannels() == 1) SetFormat( AL_FORMAT_MONO16 ); else SetFormat( AL_FORMAT_STEREO16 ); cerr << "Freq: " << GetFreq() << endl; cerr << "Channels: " << GetNumChannels() << endl; cerr << "Encoded: " << ov_comment(&m_OggFile,-1)->vendor << endl; m_lFileSize = ov_raw_total( &m_OggFile, -1); return true; }
void Weldingtool::TurnOff() { if (!Working()) return; on_ = false; SetState("welder"); SetFreq(0); }
//--------------------------------------------------------- void CrolPlayer::SetPitch(int const voice, float const variation) { if ((voice < kBassDrumChannel) || mpROLHeader->mode) { uint16_t const pitchBend = (variation == 1.0f) ? skMidPitch : static_cast<uint16_t>((0x3fff >> 1) * variation); ChangePitch(voice, pitchBend); SetFreq(voice, mNoteCache[voice], mKeyOnCache[voice]); }
ULONG ASMCALL gw_SetFreq( REG( d0, UWORD channel ), REG( d1, ULONG freq ), REG( a2, struct AHIPrivAudioCtrl* audioctrl ), REG( d2, ULONG flags ), REG( a6, struct AHIBase* AHIBase ) ) { return SetFreq( channel, freq, audioctrl, flags, AHIBase ); }
//--------------------------------------------------------- void CrolPlayer::SetNoteMelodic(int const voice, int const note) { opl->write(skOPL2_KeyOnFreqHiBaseAddress + voice, mKOnOctFNumCache[voice] & ~skOPL2_KeyOnMask); mKeyOnCache[voice] = false; if (note != kSilenceNote) { SetFreq(voice, note, true); } }
void Door::Open() { if (door_state_ != CLOSED) return; SetState("door_opening"); PlaySoundIfVisible("airlock.ogg", owner.ret_id()); door_state_ = OPENING; last_tick_ = MAIN_TICK; SetFreq(1); }
void GlassDoor::Open() { if (door_state_ != CLOSED) return; SetState(door_prefix_ + "opening"); PlaySoundIfVisible("windowdoor.ogg", owner.ret_id()); door_state_ = OPENING; last_tick_ = MAIN_TICK; SetFreq(1); }
ULONG gw_SetFreq( struct _Regs* regs ) { UWORD channel = (UWORD) GET_LONG( regs->d0 ); ULONG freq = (ULONG) GET_LONG( regs->d1 ); struct AHIPrivAudioCtrl* audioctrl = (struct AHIPrivAudioCtrl*) GET_LONG( regs->a2 ); ULONG flags = (ULONG) GET_LONG( regs->d2 ); struct AHIBase* AHIBase = (struct AHIBase*) GET_LONG( regs->a6 ); return SetFreq( channel, freq, audioctrl, flags, AHIBase ); }
void Weldingtool::TurnOn() { if (Working()) return; if (fuel_ <= 0) return; on_ = true; SetState("welder1"); SetFreq(10); }
ULONG gw_SetFreq( void ) { UWORD channel = (UWORD) REG_D0; ULONG freq = (ULONG) REG_D1; struct AHIPrivAudioCtrl* audioctrl = (struct AHIPrivAudioCtrl*) REG_A2; ULONG flags = (ULONG) REG_D2; struct AHIBase* AHIBase = (struct AHIBase*) REG_A6; return SetFreq( channel, freq, audioctrl, flags, AHIBase ); }
static void SetFreq (byte channel, word freq) { if (!freq) freq=1024; ChannelFreq[channel]=freq; channelfreq[channel]=(freq)? (3579545/(32*(int)freq)):0; if (channel_on[channel]) { ChannelOn (channel); } if (channel==2 && noise_output_channel_3) SetFreq (3,freq); }
//--------------------------------------------------------- void CrolPlayer::rewind(int subsong) { TVoiceData::iterator curr = mVoiceData.begin(); TVoiceData::iterator end = mVoiceData.end(); while(curr != end) { CVoiceData & voice = *curr; voice.Reset(); ++curr; } mHalfToneOffset = TInt16Vector(kNumPercussiveVoices, 0); mVolumeCache = TUInt8Vector(kNumPercussiveVoices, skMaxVolume); mKSLTLCache = TUInt8Vector(kNumPercussiveVoices, 0); mNoteCache = TUInt8Vector(kNumPercussiveVoices, 0); mKOnOctFNumCache = TUInt8Vector(kNumMelodicVoices, 0); mKeyOnCache = TBoolVector(kNumPercussiveVoices, false); mNextTempoEvent = 0; mCurrTick = 0; mAMVibRhythmCache = 0; opl->init(); // initialize to melodic by default opl->write(skOPL2_WaveCtrlBaseAddress, skOPL2_EnableWaveformSelectMask); // Enable waveform select if (mpROLHeader->mode == 0) { mAMVibRhythmCache = skOPL2_RhythmMask; opl->write(skOPL2_AmVibRhythmBaseAddress, mAMVibRhythmCache); // Enable rhythm mode SetFreq(kTomtomChannel, kTomTomNote); SetFreq(kSnareDrumChannel, kSnareNote); } SetRefresh(1.0f); }
bool SrSetFreq(HANDLE hCom, double *dbszFreq, unsigned int iszLen, unsigned int iFreqCount, unsigned int *pdwErr) { unsigned int freq[100]; bzero(freq, 100); freq[0] = iFreqCount; int i; for (i = 0; i < iszLen; i++) freq[i + 1] = (unsigned int) dbszFreq[i]; int ret = SetFreq(hCom, freq, pdwErr); if (ret == -1) { *pdwErr = ERR_CODE_SET_FREQ; return false; } return true; }
int SetSpeedHandler(int argc, char *argv[]) { const int correctArgc = 5; if (argc == correctArgc) { uint8_t i; for (i = 0; i < 4; i++) { int speed = atoi(argv[i + 1]); SetFreq(g_motorAddress[i],speed); } return 0; }else if (argc < correctArgc) { return CMDLINE_TOO_FEW_ARGS; }else{ return CMDLINE_TOO_MANY_ARGS; } }
/** State - initialize system */ void StateInitialize() { u16 x; u8 i; // Init VideoInitialize(); SetFreq(FREQ_60); SetScreen8(LINES_212); SetSpriteMode(SPRITE_OFF, 0, 0, 0); SetScreenColor(0, 0, COLOR8_BLACK); // Clear all VRAM ClearScreen8(COLOR8_BLACK); // Initialize (ASCII table) sprites for(x=0; x<sizeof(g_CharTable) / 8; x++) { RAMtoVRAM(Modulo2(x * 8, 256), 248 + (x / 32), 8, 1, (u16)&g_CharTable[x * 8]); } // Create default 8 bytes patern from a 8 bits byte for(x=0; x<256; x++) { for(i=0; i<8; i++) { if(x & (1 << (7 - (i & 0x07)))) game.bitToByte[x * 8 + i] = 0xFF; else game.bitToByte[x * 8 + i] = 0x00; } } // Create 3D projection table for(x=0; x<512; x++) { game.projZ[x] = (512 - x) >> 3; // (512 - x) << 6 / 512 } game.lineNum[0] = 0; game.lineNum[1] = 0; game.anaglyphFx = 2; game.playerNum = 2; game.gameSpeed = 0; game.page = 0; game.state = StateTitle; }
Ghost::Ghost(size_t id) : IMob(id) { tickSpeed = 1; pixSpeed = 2; v_level = 11; SetSprite("icons/mob.dmi"); SetState("ghost_grey"); passable_level = Passable::EMPTY; name = "Ghost"; SetFreq(10); seconds_until_respawn_ = 15; }
static int sysctl_freq(SYSCTL_HANDLER_ARGS) { struct cdev *dev = (struct cdev *)arg1; struct ptx_softc *scp = (struct ptx_softc *)dev->si_drv1; struct ptx_stream *s = (struct ptx_stream *)dev->si_drv2; FREQUENCY freq; int error; error = sysctl_handle_int(oidp, &s->freq, 0, req); if (error || !req->newptr) { return (error); } freq.frequencyno = s->freq & 0xffff; freq.slot = (s->freq >> 16)& 0xffff; return SetFreq(scp, s, &freq); }
int Phase::Set(char* mess, float value){ switch (FindMsg(mess)){ case 21: SetFreq(value); return 1; case 22: SetPhase(value); return 1; default: return SndObj::Set(mess,value); } }
int HiPass::Set(char* mess, float value){ switch (FindMsg(mess)){ case 21: SetFreq(value); return 1; case 23: SetSr(value); return 1; default: return SndObj::Set(mess,value); } }
void CTriangleInstrumentFactory::SetNote(CNote *note) { // Get a list of all attribute nodes and the // length of that list CComPtr<IXMLDOMNamedNodeMap> attributes; note->Node()->get_attributes(&attributes); long len; attributes->get_length(&len); // Loop over the list of attributes for(int i=0; i<len; i++) { // Get attribute i CComPtr<IXMLDOMNode> attrib; attributes->get_item(i, &attrib); // Get the name of the attribute CComBSTR name; attrib->get_nodeName(&name); // Get the value of the attribute. A CComVariant is a variable // that can have any type. It loads the attribute value as a // string (UNICODE), but we can then change it to an integer // (VT_I4) or double (VT_R8) using the ChangeType function // and then read its integer or double value from a member variable. CComVariant value; attrib->get_nodeValue(&value); if(name == "duration") { } else if(name == "note") { SetFreq(NoteToFrequency(value.bstrVal)); } } }
void Ghost::AfterWorldCreation() { IMob::AfterWorldCreation(); SetFreq(10); }