Beispiel #1
0
void ActionDialog::controlInfoLabel(Device *dev)
{
    DeviceOptions opts;
    if (sourceIsAudioCd) {
        opts.load(MPDConnectionDetails::configGroupName(MPDConnection::self()->getDetails().name), true);
    } else if (sourceUdi.isEmpty()) {
        opts=dev->options();
    }

    if (opts.transcoderCodec.isEmpty()) {
        codecLabel->setVisible(false);
        codec->setVisible(false);
    } else {
        codecLabel->setVisible(true);
        codec->setVisible(true);
        Encoders::Encoder encoder=Encoders::getEncoder(opts.transcoderCodec);
        if (Encoders::getEncoder(opts.transcoderCodec).codec.isEmpty()) {
            codec->setText(i18n("<b>INVALID</b>"));
        } else if (encoder.values.count()>1) {
            int settingIndex=0;
            bool increase=encoder.values.at(0).value<encoder.values.at(1).value;
            int index=0;
            foreach (const Encoders::Setting &s, encoder.values) {
                if ((increase && s.value>opts.transcoderValue) || (!increase && s.value<opts.transcoderValue)) {
                    break;
                } else {
                    settingIndex=index;
                }
                index++;
            }
            codec->setText(QString("%1 (%2)").arg(encoder.name).arg(encoder.values.at(settingIndex).descr)+
                           (sourceIsAudioCd && opts.transcoderWhenDifferent ? QLatin1String("")+i18n("<i>(When different)</i>") : QString()));
        } else {
Beispiel #2
0
void ServerSettings::load()
{
    QList<MPDConnectionDetails> all=Settings::self()->allConnections();
    QString currentCon=Settings::self()->currentConnection();

    qSort(all);
    combo->clear();
    int idx=0;
    haveBasicCollection=false;
    foreach (MPDConnectionDetails d, all) {
        combo->addItem(d.getName(), d.name);
        if (d.name==currentCon) {
            prevIndex=idx;
        }
        idx++;
        #ifdef ENABLE_SIMPLE_MPD_SUPPORT
        if (d.name==MPDUser::constName) {
            d.dir=MPDUser::self()->details().dir;
            haveBasicCollection=true;
            prevBasic=d;
        }
        #endif
        DeviceOptions opts;
        opts.load(MPDConnectionDetails::configGroupName(d.name), true);
        collections.append(Collection(d, opts));
    }
Beispiel #3
0
void HandTracker::start( const DeviceOptions& deviceOptions )
{
	stop();

	mImageResolution	= deviceOptions.getDepthResolution();
	mImageSize			= deviceOptions.getDepthSize();
	mRunning			= true;
	mThread				= ThreadRef( new thread( &HandTracker::run, this ) );
}
void KinectEcard::setup(){
	// init app window settings
	app::setWindowSize( 1280, 960 );
	app::setWindowPos( 25, 25 );

	// kinect device options
	DeviceOptions options;
	options.enableDepth( true );
	options.enableNearMode( true );
	options.enableVideo( true );
	options.setDepthResolution( ImageResolution::NUI_IMAGE_RESOLUTION_320x240 );
	options.setVideoResolution( ImageResolution::NUI_IMAGE_RESOLUTION_1280x960 );

	// init and start kinect
	mKinect = Kinect::create();
	mKinect->addDepthCallback( &KinectEcard::onDepthSurfaceReady, this );
	mKinect->addVideoCallback( &KinectEcard::onVideoSurfaceReady, this );
	mKinect->removeBackground( true );
	mKinect->enableBinaryMode( false );
	mKinect->enableUserColor( true );
	mKinect->start( options );

	// init corrected video surface

	mCorrectionMap = Surface32f( 640, 480, false, SurfaceChannelOrder::RGB );
	mRenderedCorrectionMap = false;

	// init FBO's
	mDepthFbo				= gl::Fbo( 640, 480, false );
	mVideoFbo				= gl::Fbo( 640, 480, false );
	mSubstractedVideoFbo	= gl::Fbo( 640, 480, false );
	mStoredVideoFbo			= gl::Fbo( 640, 480, false );
	mStoredDepthFbo			= gl::Fbo( 640, 480, false );

	// init shaders
	mSubstractShader		= gl::GlslProg( app::loadAsset( "passThru_vert.glsl" ), app::loadAsset( "substract_frag.glsl" ) );
	mDepthCompareShader		= gl::GlslProg( app::loadAsset( "passThru_vert.glsl" ), app::loadAsset( "depthcompare_frag.glsl" ) );
	mDepthCorrectionShader	= gl::GlslProg( app::loadAsset( "passThru_vert.glsl" ), app::loadAsset( "correction_frag.glsl" ) );

	// clear out fbo;s
	mStoredDepthFbo.bindFramebuffer();
	gl::clear( Color::white() );
	mStoredDepthFbo.unbindFramebuffer();

	mStoredVideoFbo.bindFramebuffer();
	gl::clear( Color::white() );
	mStoredVideoFbo.unbindFramebuffer();

	// set notifiers to default values
	mHasNewVideoSurface = false;
	mHasNewDepthSurface	= false;

	// set openGL settings, should not change any time
	gl::disableDepthRead();
	gl::disableDepthWrite();

	// setup mParams
	mParams = params::InterfaceGl( "App parameters", Vec2i( 200, 150 ) );
	mParams.addParam( "Draw depth correction map", &mDrawDepthCorrectionMap, "" );
	mParams.addParam( "FPS", &mFps, "", true );
	mParams.addButton( "Clear buffers", boost::bind( &KinectEcard::clear, this ) );
	mParams.addButton( "Take snapshot", boost::bind( &KinectEcard::snapshot, this ) );
	mUseDepthCorrection = true;
	mDrawDepthCorrectionMap = false;
	mFps = 0;
}