Exemplo n.º 1
0
ProcessorGraphicsItem::ProcessorGraphicsItem(Processor* processor, NetworkEditor* networkEditor)
    : PortOwnerGraphicsItem(processor, networkEditor)
    , processor_(processor)
{
    tgtAssert(processor_ != 0, "passed null pointer");

    setGuiName(QString::fromStdString(processor_->getName()));

    //set text
    initializePaintSettings();
    paintHasBeenInitialized_ = true;
    getPropertyList()->updateParentLabel();

    registerPorts();

    if (processor_->usesExpensiveComputation()) {
        QRectF boundRect = boundingRect();
        QPointF center(boundRect.x() + boundRect.width() / 2.0, boundRect.y() + boundRect.height() * 0.775);
        qreal width = boundRect.width() * 0.8;
        qreal height = 8;
        progressBar_ = new ProgressBarGraphicsItem(this, center, width, height);
        processor_->setProgressBar(progressBar_);
    }

    dynamic_cast<Observable<ProcessorObserver>* >(processor_)->addObserver(this);
}
Exemplo n.º 2
0
bool JackClient::setup(volatile bool* p_runFlag, uint32_t nrOfFramesInRingBuffer)
{
    m_p_runFlag = p_runFlag;

    const char *server_name = NULL;
    jack_options_t options = JackNoStartServer;
    jack_status_t status;

    // create a jack client
    m_p_jackClient = jack_client_open(s_jackClientName.c_str(), options, &status, server_name);
    if (m_p_jackClient == NULL) {
        DEBUG_PRINT("jack_client_open() failed, status = 0x%2.0x",
                status);
        if (status & JackServerFailed) {
            DEBUG_PRINT("unable to connect to JACK server");
        }
        return false;
    }
    if (status & JackServerStarted) {
        DEBUG_PRINT("jack server up and running");
    }
    if (status & JackNameNotUnique) {
        char* client_name = jack_get_client_name(m_p_jackClient);
        DEBUG_PRINT("unique name `%s' assigned", client_name);
    }


    // create ringbuffer
    m_p_ringBuffer = jack_ringbuffer_create(sizeof(jack_default_audio_sample_t) * jack_get_buffer_size(m_p_jackClient) * nrOfFramesInRingBuffer);
    if (m_p_ringBuffer == NULL) {
        DEBUG_PRINT("failed to create ringbuffer");
        return false;
    }

    // setup callbacks
    int check;
    if ((check = jack_set_process_callback(m_p_jackClient, JackClient::processJackCallback, this))) {
        return false;
    }

    jack_on_shutdown(m_p_jackClient, JackClient::shutdownJackCallback, this);

    if ((check = jack_set_port_connect_callback(m_p_jackClient, JackClient::connectionJackCallback, this))) {
        return false;
    }

    if (!registerPorts()) {
        return false;
    }


    return true;
}
Exemplo n.º 3
0
BOOL CGraspCaptureDlg::OnInitDialog()
{

	CDialog::OnInitDialog();

	// Add "About..." menu item to system menu.

	// IDM_ABOUTBOX must be in the system command range.
	ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
	ASSERT(IDM_ABOUTBOX < 0xF000);

	CMenu* pSysMenu = GetSystemMenu(FALSE);
	if (pSysMenu != NULL) {
		CString strAboutMenu;
		strAboutMenu.LoadString(IDS_ABOUTBOX);
		if (!strAboutMenu.IsEmpty()) {
			pSysMenu->AppendMenu(MF_SEPARATOR);
			pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
		}
	}

	// Set the icon for this dialog.  The framework does this automatically
	//  when the application's main window is not a dialog
	SetIcon(m_hIcon, TRUE);			// Set big icon
	SetIcon(m_hIcon, FALSE);		// Set small icon

	// create and set up dialogs
	GloveDialog.Create(CLiveGloveDlg::IDD, this);
	Tracker0Dialog.Create(CLiveTrackerDlg::IDD, this);
	Tracker0Dialog.SetWindowText("LIVE: Tracker #0");
	Tracker1Dialog.Create(CLiveTrackerDlg::IDD, this);
	Tracker1Dialog.SetWindowText("LIVE: Tracker #1");
	Camera0Dialog.Create(CLiveCameraDlg::IDD, this);
	Camera0Dialog.SetWindowText("LIVE: Camera #0");
	Camera1Dialog.Create(CLiveCameraDlg::IDD, this);
	Camera1Dialog.SetWindowText("LIVE: Camera #1");
	// enable windows
	GetDlgItem(IDC_ACQ_START)->EnableWindow(FALSE);
	GetDlgItem(IDC_ACQ_STOP)->EnableWindow(FALSE);
	GetDlgItem(IDC_LIVE_CAMERA)->EnableWindow(FALSE);
	GetDlgItem(IDC_LIVE_GLOVE)->EnableWindow(FALSE);
	GetDlgItem(IDC_LIVE_TRACKER)->EnableWindow(FALSE);
	GetDlgItem(IDC_DISCONNECT)->EnableWindow(FALSE);

	// intialise sequence acquisition:
	// sequence index is initially 0
	nSeq = 0;
	// sequence prefix is initially that decided in the options
	m_prefixEdit = _options.prefix;

	if ( ! registerPorts() ) {
		MessageBox("Could not register ports.", "Fatal error.",MB_ICONERROR);
		exit(YARP_FAIL);
	}

    std::cout.precision(2); std::cout.setf(ios::fixed);
	YARPScheduler::setHighResScheduling();

	return TRUE;  // return TRUE  unless you set the focus to a control

}