// Open DUO camera sensor bool DUOStereoSensorDriver::openCamera() { if (camera_open) return true; if(!OpenDUOCamera(frameSize.width, frameSize.height, 30)) { camera_open = false; return false; } camera_open = true; // Set exposure and LED brightness SetGain(duoProperties->gain); SetExposure(duoProperties->exposure); SetLed(duoProperties->led); // Un-flip frames SetVFlip(true); // Enable retrieval of undistorted (rectified) frames SetUndistort(true); return true; }
void Flea3Camera::Configure(Config& config) { // Video Mode SetVideoMode(config.video_mode, config.format7_mode, config.pixel_format, config.width, config.height); // Update CameraInfo here after video mode is changed camera_info_ = GetCameraInfo(camera_); // Frame Rate SetFrameRate(config.fps); // Raw Bayer SetRawBayerOutput(config.raw_bayer_output); // White Balance SetWhiteBalanceRedBlue(config.white_balance, config.auto_white_balance, config.wb_red, config.wb_blue); // Exposure SetExposure(config.exposure, config.auto_exposure, config.exposure_value); SetShutter(config.auto_shutter, config.shutter_ms); SetGain(config.auto_gain, config.gain_db); SetBrightness(config.brightness); SetGamma(config.gamma); // Strobe SetStrobe(config.strobe_control, config.strobe_polarity); // Trigger SetTrigger(config.trigger_source, config.trigger_polarity); // Save this config config_ = config; }
status_t GameSoundBuffer::SetAttributes(gs_attribute * attributes, size_t attributeCount) { status_t error = B_OK; for (size_t i = 0; i < attributeCount; i++) { switch(attributes[i].attribute) { case B_GS_GAIN: error = SetGain(attributes[i].value, attributes[i].duration); break; case B_GS_PAN: error = SetPan(attributes[i].value, attributes[i].duration); break; case B_GS_LOOPING: fLooping = bool(attributes[i].value); break; default: break; } } return error; }
void SoundSource::Play(Sound* sound, float frequency, float gain, float panning) { SetFrequency(frequency); SetGain(gain); SetPanning(panning); Play(sound); }
/***************************************************************************** ** Procedure: CDSPhone::UnsolicitedEvent ** ** Arguments: 'lpBuff' - Data buffer (structure) specific to code ** ** Returns: void ** ** Description: This function processes any responses from the device which ** are not matched to a pending line request. ** *****************************************************************************/ bool CDSPhone::UnsolicitedEvent(LPCVOID lpBuff) { USES_CONVERSION; EVENTBUFF* pevBuff = (EVENTBUFF*) lpBuff; switch (pevBuff->dwResponse) { // A lamp has changed states. case EMRESULT_LAMPCHANGED: { LPEMLAMPCHANGE lpChange = (LPEMLAMPCHANGE) pevBuff->lpBuff; SetLampState ((int)lpChange->wButtonLampID, g_LampStates[lpChange->wLampState]); } break; // A hookswitch device has changed states. case EMRESULT_HSCHANGED: { LPEMHOOKSWITCHCHANGE lpChange = (LPEMHOOKSWITCHCHANGE) pevBuff->lpBuff; _TSP_ASSERTE (lpChange->wHookswitchID == HSDEVICE_HANDSET); SetHookSwitch (PHONEHOOKSWITCHDEV_HANDSET, g_hsStates[lpChange->wHookswitchState]); } break; // A button has changed case EMRESULT_BUTTONCHANGED: { LPEMBUTTONCHANGE lpChange = (LPEMBUTTONCHANGE) pevBuff->lpBuff; SetButtonState (lpChange->wButtonLampID, g_ButtonStates[lpChange->wButtonState]); } break; // Ringer mode changed case EMRESULT_RINGCHANGE: SetRingMode (*((LPDWORD)pevBuff->lpBuff)); break; // Volume/Gain of the handset changed case EMRESULT_LEVELCHANGED: { LPEMLEVELCHANGE lpChange = (LPEMLEVELCHANGE) pevBuff->lpBuff; if (lpChange->wLevelType == LEVELTYPE_MIC) SetGain (PHONEHOOKSWITCHDEV_HANDSET, lpChange->wLevel); else if (lpChange->wLevelType == LEVELTYPE_SPEAKER) SetVolume (PHONEHOOKSWITCHDEV_HANDSET, lpChange->wLevel); } break; // The display has changed. case EMRESULT_DISPLAYCHANGED: { LPEMDISPLAY lpChange = (LPEMDISPLAY) pevBuff->lpBuff; SetDisplay (A2T(lpChange->szDisplay)); } break; } return true; }// CDSPhone::UnsolicitedEvent
/*--------------------------------------------------------------------------------*/ AudioObjectParameters& AudioObjectParameters::Modify(const Modifier& modifier, const ADMAudioObject *object) { if (modifier.rotation.IsSet()) { SetPosition(GetPosition() * modifier.rotation.Get()); if (IsMinPositionSet()) SetMinPosition(GetMinPosition() * modifier.rotation.Get()); if (IsMaxPositionSet()) SetMaxPosition(GetMaxPosition() * modifier.rotation.Get()); Position size(GetWidth(), GetDepth(), GetHeight()); size *= modifier.rotation.Get(); SetWidth(static_cast<float>(size.pos.x)); SetDepth(static_cast<float>(size.pos.y)); SetHeight(static_cast<float>(size.pos.z)); } if (modifier.position.IsSet()) SetPosition(GetPosition() + modifier.position.Get()); if (modifier.scale.IsSet()) { SetPosition(GetPosition() * modifier.scale.Get()); if (IsMinPositionSet()) SetMinPosition(GetMinPosition() * modifier.scale.Get()); if (IsMaxPositionSet()) SetMaxPosition(GetMaxPosition() * modifier.scale.Get()); Position size(GetWidth(), GetDepth(), GetHeight()); size *= modifier.scale.Get(); SetWidth(static_cast<float>(size.pos.x)); SetDepth(static_cast<float>(size.pos.y)); SetHeight(static_cast<float>(size.pos.z)); } if (modifier.gain.IsSet()) SetGain(GetGain() * modifier.gain.Get()); // apply specific modifications (from derived classes) modifier.Modify(*this, object); return *this; }
TrLadGain::TrLadGain(int hwid, float* gain, float* offset, float* syserr, int* status) { Clear(); SetHwId(hwid); SetGain(gain); SetOffset(offset); SetSysErr(syserr); SetStatus(status); }
void HDRPage::OnGainScroll( int image ) { Gtk::Adjustment* pAdjustment = m_hdrImageArray[image].pAdjustmentGain; double value = pAdjustment->get_value(); SetGain( image, static_cast<unsigned int>(value) ); }
void Source::SetGain(float value) { #ifdef HAS_AUDIO_SOURCE impl->SetGain(value); #else (void)value; throw System::PunkException(L"Audio source is not available"); #endif }
bool TrLadGain::LinearToGainDB(float* offset) { if (!offset) return false; SetHwId((int)offset[0]); SetGain(offset+1); SetOffset(offset+1+16); SetSysErr(offset+1+16+16); SetStatus(offset+1+16+16+16); return true; }
AudioSource::AudioSource(AudioBuffer* buff) { alGenSources(1, &source); SetGain(1); SetPitch(1); SetLooping(false); SetPosition(0,0,0); SetVelocity(0,0,0); alSourcei(source, AL_BUFFER, buff->GetBuffer()); }
HRESULT StreamContext::Open(DeviceContext *pDeviceContext, LPWAVEOPENDESC lpWOD, DWORD dwFlags) { m_RefCount = 1; m_pDeviceContext = pDeviceContext; m_pfnCallback = (DRVCALLBACK *)lpWOD->dwCallback; m_dwInstance = lpWOD->dwInstance; m_hWave = lpWOD->hWave; m_dwFlags = dwFlags; m_bRunning = FALSE; m_bForceSpeaker = FALSE; // If it's a PCMWAVEFORMAT struct, it's smaller than a WAVEFORMATEX struct (it doesn't have the cbSize field), // so don't copy too much or we risk a fault if the structure is located on the end of a page. // All other non-PCM wave formats share the WAVEFORMATEX base structure // Note: I don't keep around anything after the cbSize of the WAVEFORMATEX struct so that I don't need to // worry about allocating additional space. If we need to keep this info around in the future, we can either // allocate it dynamically here, or keep the information in any derived format-specific classes. DWORD dwSize; WAVEFORMATEX *pwfx = lpWOD->lpFormat; if (pwfx->wFormatTag == WAVE_FORMAT_PCM) { dwSize = sizeof(PCMWAVEFORMAT); m_WaveFormat.cbSize = 0; } else { dwSize = sizeof(WAVEFORMATEX); } memcpy(&m_WaveFormat,pwfx,dwSize); m_lpWaveHdrHead = NULL; m_lpWaveHdrTail = NULL; m_lpWaveHdrCurrent = NULL; m_lpCurrData = NULL; m_lpCurrDataEnd = NULL; m_dwByteCount = 0; m_dwLoopCount = 0; m_SecondaryGainClass=0; SetGain(pDeviceContext->GetDefaultStreamGain()); // Set gain to default value // Add stream to list. This will start playback. pDeviceContext->NewStream(this); DoCallbackStreamOpened(); return S_OK; }
//Decrements general volume void SoundManager::VolumeDown(float amount) { //Reduce volume in "LISTENER" //Local variables float CurrentGain; //Value to decrement CurrentGain = GetGain(); //Decrement CurrentGain -= amount; //Limits if (CurrentGain < 0) { CurrentGain = 0; } //Set gain decremented SetGain(CurrentGain); }
//Increments general volume void SoundManager::VolumeUp(float amount) { //Increment volume in "LISTENER" //Local variables float CurrentGain; //Value to increment CurrentGain = GetGain(); //Increment CurrentGain += amount; //Limits if (CurrentGain > GAINLIMIT) { CurrentGain = GAINLIMIT; } //Set gain incremented SetGain(CurrentGain); }
bool SetTrackAudioCommand::ApplyInner(const CommandContext & context, Track * t ) { static_cast<void>(context); auto wt = dynamic_cast<WaveTrack *>(t); auto pt = dynamic_cast<PlayableTrack *>(t); if( wt && bHasGain ) wt->SetGain(DB_TO_LINEAR(mGain)); if( wt && bHasPan ) wt->SetPan(mPan/100.0); // These ones don't make sense on the second channel of a stereo track. if( !bIsSecondChannel ){ if( pt && bHasSolo ) pt->SetSolo(bSolo); if( pt && bHasMute ) pt->SetMute(bMute); } return true; }
void SetSpeed(bool isHigh) { if(isHigh) qhyusb->QCam.transferspeed = 1; else qhyusb->QCam.transferspeed = 0; switch(qhyusb->QCam.CAMERA) { case DEVICETYPE_QHY5LII: case DEVICETYPE_QHY5II: { if(isHigh) { if(qhyusb->QCam.transferBit == 16) q5lii->SetSpeedQHY5LII(1); else q5lii->SetSpeedQHY5LII(2); } else { if(qhyusb->QCam.transferBit == 16) q5lii->SetSpeedQHY5LII(0); else q5lii->SetSpeedQHY5LII(1); } break; } } SetExposeTime(qhyusb->QCam.camTime); SetGain(qhyusb->QCam.camGain); if(qhyusb->QCam.isColor) { SetWBRed(qhyusb->QCam.wbred); SetWBBlue(qhyusb->QCam.wbblue); SetWBGreen(qhyusb->QCam.wbgreen); } }
void CSoundGroup::SetDefaultValues() { m_index = 0; m_Flags = 0; m_Intensity = 0; m_CurTime = 0.0f; // sane defaults; will probably be replaced by the values read during LoadSoundGroup. SetGain(0.7f); m_Pitch = 1.0f; m_Priority = 60; m_PitchUpper = 1.1f; m_PitchLower = 0.9f; m_GainUpper = 1.0f; m_GainLower = 0.8f; m_ConeOuterGain = 0.0f; m_ConeInnerAngle = 360.0f; m_ConeOuterAngle = 360.0f; m_Decay = 3.0f; m_IntensityThreshold = 3; // WARNING: m_TimeWindow is currently unused and uninitialized }
Track::Holder NoteTrack::Duplicate() const { auto duplicate = std::make_unique<NoteTrack>(mDirManager); duplicate->Init(*this); // Duplicate on NoteTrack moves data from mSeq to mSerializationBuffer // and from mSerializationBuffer to mSeq on alternate calls. Duplicate // to the undo stack and Duplicate back to the project should result // in serialized blobs on the undo stack and traversable data in the // project object. if (mSeq) { SonifyBeginSerialize(); assert(!mSerializationBuffer); // serialize from this to duplicate's mSerializationBuffer mSeq->serialize((void**)&duplicate->mSerializationBuffer, &duplicate->mSerializationLength); SonifyEndSerialize(); } else if (mSerializationBuffer) { SonifyBeginUnserialize(); assert(!mSeq); Alg_track_ptr alg_track = Alg_seq::unserialize(mSerializationBuffer, mSerializationLength); assert(alg_track->get_type() == 's'); duplicate->mSeq = (Alg_seq_ptr) alg_track; SonifyEndUnserialize(); } else assert(false); // bug if neither mSeq nor mSerializationBuffer // copy some other fields here duplicate->SetBottomNote(mBottomNote); duplicate->SetPitchHeight(mPitchHeight); duplicate->mLastMidiPosition = mLastMidiPosition; duplicate->mVisibleChannels = mVisibleChannels; duplicate->SetOffset(GetOffset()); #ifdef EXPERIMENTAL_MIDI_OUT duplicate->SetGain(GetGain()); #endif return std::move(duplicate); }
void SoundSource::Play(Sound* sound, float frequency, float gain) { SetFrequency(frequency); SetGain(gain); Play(sound); }
void SetResolution(int x,int y) { switch(qhyusb->QCam.CAMERA) { case DEVICETYPE_QHY5II: { q5ii->CorrectQHY5IIWH(&x,&y); break; } case DEVICETYPE_QHY5LII: { q5lii->CorrectQHY5LIIWH(&x,&y); break; } case DEVICETYPE_QHY6: { qhy6->CorrectQHY6WH(&x,&y); break; } case DEVICETYPE_QHY9: { qhy9->CorrectQHY9WH(&x,&y); break; } case DEVICETYPE_IC8300: { ic8300->CorrectIC8300WH(&x,&y); break; } case DEVICETYPE_QHY11: { qhy11->CorrectQHY11WH(&x,&y); break; } case DEVICETYPE_QHY21: { qhy21->CorrectQHY21WH(&x,&y); break; } case DEVICETYPE_QHY22: { qhy22->CorrectQHY22WH(&x,&y); break; } case DEVICETYPE_QHY23: { qhy23->CorrectQHY23WH(&x,&y); break; } case DEVICETYPE_QHY16000: { qhy16000->CorrectQHY16000WH(&x,&y); break; } } qhyusb->QCam.cameraW = x; qhyusb->QCam.cameraH = y; SetExposeTime(qhyusb->QCam.camTime); SetGain(qhyusb->QCam.camGain); SetUSBTraffic(qhyusb->QCam.usbtraffic); if(qhyusb->QCam.isColor) { SetWBGreen(qhyusb->QCam.wbgreen); SetWBRed(qhyusb->QCam.wbred); SetWBBlue(qhyusb->QCam.wbblue); } }
/***************************************************************************** ** Procedure: CJTPhone::UnsolicitedEvent ** ** Arguments: 'lpBuff' - Our CEventBlock* pointer ** ** Returns: void ** ** Description: This function is called when no request processed a given ** response from the device and it was directed at this phone. ** *****************************************************************************/ bool CJTPhone::UnsolicitedEvent(LPCVOID lpBuff) { // Cast our pointer back to an event block const CEventBlock* pBlock = static_cast<const CEventBlock*>(lpBuff); // Manage the phone event we have received. switch (pBlock->GetEventType()) { // Display changed case CEventBlock::DisplayChanged: { // Get the new display string and set it into our device. const CPEDisplay* pDisplay = dynamic_cast<const CPEDisplay*>(pBlock->GetElement(CPBXElement::Display)); if (pDisplay != NULL) SetDisplay(pDisplay->GetDisplay().c_str()); } break; // Volume changed case CEventBlock::VolumeChanged: { const CPEVolume* pVolume = dynamic_cast<const CPEVolume*>(pBlock->GetElement(CPBXElement::Volume)); if (pVolume != NULL) SetVolume(PHONEHOOKSWITCHDEV_SPEAKER, pVolume->GetVolume()); } break; // Gain changed case CEventBlock::GainChanged: { const CPEGain* pGain = dynamic_cast<const CPEGain*>(pBlock->GetElement(CPBXElement::Gain)); if (pGain != NULL) SetGain(PHONEHOOKSWITCHDEV_SPEAKER, pGain->GetGain()); } break; // Hookswitch changed case CEventBlock::HookswitchChanged: { const CPEHookswitch* pHS = dynamic_cast<const CPEHookswitch*>(pBlock->GetElement(CPBXElement::Hookswitch)); if (pHS != NULL) { SetHookSwitch(PHONEHOOKSWITCHDEV_HEADSET, (pHS->GetHookswitchState() == CPEHookswitch::OnHook) ? PHONEHOOKSWITCHMODE_ONHOOK : (pHS->GetHookswitchState() == CPEHookswitch::OffHook) ? PHONEHOOKSWITCHMODE_MICSPEAKER : PHONEHOOKSWITCHMODE_SPEAKER); } } break; // Lamp changed case CEventBlock::LampChanged: { const CPELampInfo* pLamp = dynamic_cast<const CPELampInfo*>(pBlock->GetElement(CPBXElement::Lamp)); if (pLamp != NULL) { _TSP_ASSERTE(pLamp->GetLampID() == 0 || pLamp->GetLampID() == 1); // Note we could search for the button we want, but since we know the // button layout of the phone we will just use it directly. // If this were a production TSP it would probably keep a mapping of // button id to lamps from the PBX and use that to lookup the proper // button. int iButtonID = (pLamp->GetLampID() == 0) ? 21 : 22; SetLampState(iButtonID, (pLamp->IsLit()) ? PHONELAMPMODE_STEADY : PHONELAMPMODE_OFF); } } break; // Unknown or unhandled default: break; } // It doesn't really matter what we return to this function since we are letting // the library handle the request management directly. The caller doesn't look // at the return code for unsolicited handlers. If we were managing the // ReceiveData() ourselves then this could be used to continue looking for // an owner for a data event. return true; }// CJTPhone::UnsolicitedEvent
bool CSoundGroup::LoadSoundGroup(const VfsPath& pathnameXML) { CXeromyces XeroFile; if (XeroFile.Load(g_VFS, pathnameXML) != PSRETURN_OK) { HandleError(L"error loading file", pathnameXML, ERR::FAIL); return false; } // Define elements used in XML file #define EL(x) int el_##x = XeroFile.GetElementID(#x) #define AT(x) int at_##x = XeroFile.GetAttributeID(#x) EL(soundgroup); EL(gain); EL(looping); EL(omnipresent); EL(distanceless); EL(pitch); EL(priority); EL(randorder); EL(randgain); EL(randpitch); EL(conegain); EL(coneinner); EL(coneouter); EL(sound); EL(gainupper); EL(gainlower); EL(pitchupper); EL(pitchlower); EL(path); EL(threshold); EL(decay); #undef AT #undef EL XMBElement root = XeroFile.GetRoot(); if (root.GetNodeName() != el_soundgroup) { LOGERROR(L"Invalid SoundGroup format (unrecognised root element '%hs')", XeroFile.GetElementString(root.GetNodeName()).c_str()); return false; } XERO_ITER_EL(root, child) { int child_name = child.GetNodeName(); if(child_name == el_gain) { SetGain(child.GetText().ToFloat()); } else if(child_name == el_looping) { if(child.GetText().ToInt() == 1) SetFlag(eLoop); } else if(child_name == el_omnipresent) { if(child.GetText().ToInt() == 1) SetFlag(eOmnipresent); } else if(child_name == el_distanceless) { if(child.GetText().ToInt() == 1) SetFlag(eDistanceless); } else if(child_name == el_pitch) { this->m_Pitch = child.GetText().ToFloat(); } else if(child_name == el_priority) { this->m_Priority = child.GetText().ToFloat(); } else if(child_name == el_randorder) { if(child.GetText().ToInt() == 1) SetFlag(eRandOrder); } else if(child_name == el_randgain) { if(child.GetText().ToInt() == 1) SetFlag(eRandGain); } else if(child_name == el_gainupper) { this->m_GainUpper = child.GetText().ToFloat(); } else if(child_name == el_gainlower) { this->m_GainLower = child.GetText().ToFloat(); } else if(child_name == el_randpitch) { if(child.GetText().ToInt() == 1) SetFlag(eRandPitch); } else if(child_name == el_pitchupper) { this->m_PitchUpper = child.GetText().ToFloat(); } else if(child_name == el_pitchlower) { this->m_PitchLower = child.GetText().ToFloat(); } else if(child_name == el_conegain) { this->m_ConeOuterGain = child.GetText().ToFloat(); } else if(child_name == el_coneinner) { this->m_ConeInnerAngle = child.GetText().ToFloat(); } else if(child_name == el_coneouter) { this->m_ConeOuterAngle = child.GetText().ToFloat(); } else if(child_name == el_sound) { this->filenames.push_back(child.GetText().FromUTF8()); } else if(child_name == el_path) { m_filepath = child.GetText().FromUTF8(); } else if(child_name == el_threshold) { m_IntensityThreshold = child.GetText().ToFloat(); } else if(child_name == el_decay) { m_Decay = child.GetText().ToFloat(); } }
void ReplayGain::Info::SetGain(const std::string& aStrGain) { SetGain(static_cast<float>(atof(aStrGain.c_str()))); }
void SetValue(CONTROL_ID id, double value) { switch(id) { case CONTROL_WBR: { SetWBRed((int)value); break; } case CONTROL_WBG: { SetWBGreen((int)value); break; } case CONTROL_WBB: { SetWBBlue((int)value); break; } case CONTROL_EXPOSURE: { SetExposeTime(value); break; } case CONTROL_GAIN: { SetGain((unsigned short)value); break; } case CONTROL_OFFSET: { SetOffset((unsigned char)value); break; } case CONTROL_SPEED: { if((int)value) SetSpeed(true); else SetSpeed(false); break; } case CONTROL_USBTRAFFIC: { if(qhyusb->QCam.CAMERA == DEVICETYPE_QHY5II || qhyusb->QCam.CAMERA == DEVICETYPE_QHY5LII) { SetUSBTraffic(value); SetExposeTime(qhyusb->QCam.camTime); SetGain(qhyusb->QCam.camGain); if(qhyusb->QCam.isColor) { SetWBRed(qhyusb->QCam.wbred); SetWBBlue(qhyusb->QCam.wbblue); SetWBGreen(qhyusb->QCam.wbgreen); } } break; } case CONTROL_TRANSFERBIT: { SetTransferBit((int)value); break; } case CONTROL_ROWNOISERE: { if(qhyusb->QCam.CAMERA == DEVICETYPE_QHY5II) { if((int)value) q5ii->QHY5II_DeNoise(true); else q5ii->QHY5II_DeNoise(false); SetResolution(qhyusb->QCam.cameraW,qhyusb->QCam.cameraH); } break; } case CONTROL_HDRMODE: { if((int)value) q5lii->SetQHY5LIIHDR(true); else q5lii->SetQHY5LIIHDR(false); if(qhyusb->QCam.CAMERA == DEVICETYPE_QHY5LII) { if((int)value) q5lii->SetQHY5LIIHDR(true); else { q5lii->SetQHY5LIIHDR(false); usleep(100000); q5lii->SetQHY5LIIHDR(true); usleep(100000); q5lii->SetQHY5LIIHDR(false); usleep(100000); } } break; } case CONTROL_COOLER: { value = (value/100)*255; BeginCooler((unsigned char)value); break; } } }
static bool find_pad(LinuxPADState *s) { uint8_t idx = 1 - s->padState.port; if(idx > 1) return false; memset(&wheel_data, 0, sizeof(wheel_data_t)); // Setting to unpressed wheel_data.axis_x = 0x3FF >> 1; wheel_data.axis_y = 0xFF; wheel_data.axis_z = 0xFF; wheel_data.axis_rz = 0xFF; memset(s->axismap, -1, sizeof(s->axismap)); memset(s->btnmap, -1, sizeof(s->btnmap)); s->axis_count = 0; s->button_count = 0; s->fd = -1; s->fdFF = -1; s->effect.id = -1; if(!player_joys[idx].empty() && file_exists(player_joys[idx])) { if ((s->fd = open(player_joys[idx].c_str(), O_RDONLY | O_NONBLOCK)) < 0) { Dbg("Cannot open player %d's controller: %s\n", idx+1, player_joys[idx].c_str()); } else { //int flags = fcntl(s->fd, F_GETFL, 0); //fcntl(s->fd, F_SETFL, flags | O_NONBLOCK); // Axis Mapping if (ioctl(s->fd, JSIOCGAXMAP, s->axismap) < 0) { Dbg("Axis mapping: %s\n", strerror(errno)); } else { ioctl(s->fd, JSIOCGAXES, &s->axis_count); for(int i = 0; i < s->axis_count; ++i) Dbg("Axis: %d -> %d\n", i, s->axismap[i] ); } // Button Mapping if (ioctl(s->fd, JSIOCGBTNMAP, s->btnmap) < 0) { Dbg("Button mapping: %s\n", strerror(errno)); } else { ioctl(s->fd, JSIOCGBUTTONS, &s->button_count); for(int i = 0; i < s->button_count; ++i) Dbg("Button: %d -> %d \n", i, s->btnmap[i] ); } std::stringstream event; int index = 0; const char *tmp = player_joys[idx].c_str(); while(*tmp && !isdigit(*tmp)) tmp++; sscanf(tmp, "%d", &index); Dbg("input index: %d of '%s'\n", index, player_joys[idx].c_str()); for (int j = 0; j <= 99; j++) { event.clear(); event.str(std::string()); /* Try to discover the corresponding event number */ event << "/sys/class/input/js" << index << "/device/event" << j; if (dir_exists(event.str())){ event.clear(); event.str(std::string()); event << "/dev/input/event" << j; break; } } if ((s->fdFF = open(event.str().c_str(), O_WRONLY)) < 0) { Dbg("Cannot open '%s'\n", event.str().c_str()); } else { s->effect.type = FF_CONSTANT; s->effect.id = -1; s->effect.u.constant.level = 0; /* Strength : 25 % */ s->effect.direction = 0x4000; s->effect.u.constant.envelope.attack_length = 0;//0x100; s->effect.u.constant.envelope.attack_level = 0; s->effect.u.constant.envelope.fade_length = 0;//0x100; s->effect.u.constant.envelope.fade_level = 0; s->effect.trigger.button = 0; s->effect.trigger.interval = 0; s->effect.replay.length = 0X7FFFUL; /* mseconds */ s->effect.replay.delay = 0; if (ioctl(s->fdFF, EVIOCSFF, &(s->effect)) < 0) { Dbg("Failed to upload effect to '%s'\n", event.str().c_str()); } SetGain(s, 75); SetAutoCenter(s, 0); } return true; } } return false; }
void InitCamera(void) { unsigned char buf[4]; switch(qhyusb->QCam.CAMERA) { case DEVICETYPE_QHY5II: case DEVICETYPE_QHY5LII: { qhyusb->qhyccd_vTXD(qhyusb->QCam.ccd_handle,0xc1,buf,4); SetUSBTraffic(30); SetSpeed(false); if(qhyusb->QCam.CAMERA == DEVICETYPE_QHY5LII) { SetResolution(1280,960); q5lii->SetExposureTime_QHY5LII(1000); } else if(qhyusb->QCam.CAMERA == DEVICETYPE_QHY5II) { SetResolution(1280,1024); q5ii->SetExposureTime_QHY5II(1000); } break; } case DEVICETYPE_QHY6: case DEVICETYPE_QHY9: case DEVICETYPE_IC8300: case DEVICETYPE_QHY11: case DEVICETYPE_QHY22: case DEVICETYPE_QHY21: case DEVICETYPE_QHY23: { SetExposeTime(1000.0); SetGain(0); SetOffset(130); SetSpeed(false); if(qhyusb->QCam.CAMERA == DEVICETYPE_QHY6) { SetResolution(800,298); } else if(qhyusb->QCam.CAMERA == DEVICETYPE_QHY9 || qhyusb->QCam.CAMERA == DEVICETYPE_IC8300) { SetResolution(3584,2574); } else if(qhyusb->QCam.CAMERA == DEVICETYPE_QHY11) { SetResolution(4096,2720); } else if(qhyusb->QCam.CAMERA == DEVICETYPE_QHY22) { SetResolution(3072,2240); } else if(qhyusb->QCam.CAMERA == DEVICETYPE_QHY21) { SetResolution(2048,1500); } else if(qhyusb->QCam.CAMERA == DEVICETYPE_QHY23) { SetResolution(3468,2728); } else if(qhyusb->QCam.CAMERA == DEVICETYPE_QHY16000) { SetResolution(4960,3328); } break; } } InitOthers(); }
void nuiSound::SetGainDb(float Db) { SetGain(DBToGain(Db)); }
void ChildChanged(Value* pvalue, Value* pvalueNew) { // the only child is the gain value, so let's adjust that. ZSucceeded(SetGain(m_fCurrentGain)); };