Exemple #1
0
void Writer::writeTextRec(string address, string curLctr, bool close) {
	// append the address to the open text record
	// if the boolean close == true then close the current text record and opens a new one
    // if the remaining space in this record is less than the space of the new address, Open a new record
    // or was explicitly asked to open a new record
    //also set the length of the closed record
    if (curRec.length() + address.length() >=69 || close)
        closeRecord();

    if (startNewRecord){
        startNewRecord = 0;
        curRec = "T";
        for(unsigned int i =curLctr.length() ; i<6 ; i++)
            curRec +="0";
        curRec +=curLctr ;
        //reserved space for record length
        curRec +="##";


    }

        recLen+=address.length()/2;

        curRec += address;
}
Exemple #2
0
int main()
{
	char buf[256];
	register int i;
	FILE *f;

	sampleFormat(PA_SAMPLE_S16BE,2); /* Valor por defecto, no hace falta llamar a esta función */

	if(openRecord("prueba")) puts("error");
	if(openPlay("prueba")) puts("error");

	f=fopen("pruebasonido","w+b");
	puts("Grabando");
	for(i=0; i < 10000; ++i)
	{
		recordSound(buf,160);
		fwrite(buf,1,160,f);
	}
	fclose(f);
	closeRecord();

	f=fopen("pruebasonido","rb");
	puts("Reproduciendo");
	for(i=0; i < 10000; ++i)
	{
		fread(buf,1,160,f);
		playSound(buf,160);
	}
	fclose(f);
	closePlay();
}
Exemple #3
0
void Writer::end(string address){
    //writes the end record
    //@param address is the address of the first executable instruction in object program

    if(curRec!="")
        closeRecord();

    curRec = "E";
    for( int i =address.length() ; i<6 ; i++)
        curRec +="0";
    curRec+=address;
    modBuffer[modIndex++] = curRec;
    dumpTexToFile();
    dumpModToFile();
    closeObjFile();
}
MainWindow::MainWindow( QWidget* parent, Qt::WFlags flags )
    : QMainWindow( parent, flags )
   // Misc  -------------------------------------------------------------------------
    , content( new QStackedWidget() )
    , tabWidget( new QTabWidget() )
    , nextTabId( 1 )
    , carnaModelFactory( new CarnaModelFactory( server ) )
    , componentWindowFactory( *this )
   // File Menu  --------------------------------------------------------------------
    , exporting( new QAction( "&Export...", this ) )
    , normalizing( new QAction( "&Normalize...", this ) )
    , masking( new QAction( "&Mask Dataset...", this ) )
    , closing( new QAction( "&Close", this ) )
   // View Menu  --------------------------------------------------------------------
    , acquiringViewTab( new QAction( "New &Tab", this ) )
#ifndef NO_CRA
    , acquiringLocalizer( new QAction( "&Localizer", this ) )
    , acquiringRegistration( new QAction( "&Registration...", this ) )
#endif
    , acquiringModelInfo( new QAction( "&Properties", this ) )
    , acquiringObjectsManager( new QAction( "Objects...", this ) )
    , acquiringPointClouds( new QAction( "&Point Clouds...", this ) )
    , acquiringGulsun( new QAction( "&Gulsun Vessel Segmentation", this ) )
    , maskExporting( new QAction( "&Export Binary Mask...", this ) )
    , maskImporting( new QAction( "&Import Binary Mask...", this ) )
{
    this->setWindowTitle( "DICOM Viewer 3" );
    this->resize( 750, 750 );

    // -----------------------------------------------------------------

    QAction* exiting  = new QAction( "E&xit" , this );

    exiting->setShortcuts( QKeySequence::Quit );

    QMenu* fileMenu = menuBar()->addMenu( "&File" );
    fileMenu->addAction( acquiringModelInfo );
    fileMenu->addSeparator();
    fileMenu->addAction( normalizing );
    fileMenu->addAction( masking );
    fileMenu->addSeparator();
    fileMenu->addAction( maskImporting );
    fileMenu->addAction( maskExporting );
    fileMenu->addSeparator();
    fileMenu->addAction( exporting );
    fileMenu->addAction( closing );
    fileMenu->addSeparator();
    fileMenu->addAction( exiting );

    closing->setShortcut( QKeySequence( Qt::CTRL + Qt::Key_W ) );
    exiting->setShortcut( QKeySequence( Qt::ALT + Qt::Key_F4 ) );

    closing->setEnabled( false );
    exporting->setEnabled( false );
    normalizing->setEnabled( false );
    masking->setEnabled( false );
    maskExporting->setEnabled( false );
    maskImporting->setEnabled( false );

    connect( exporting    , SIGNAL( triggered() ), this, SLOT( exportRecord() ) );
    connect( normalizing  , SIGNAL( triggered() ), this, SLOT(    normalize() ) );
    connect( masking      , SIGNAL( triggered() ), this, SLOT(         mask() ) );
    connect( closing      , SIGNAL( triggered() ), this, SLOT(  closeRecord() ) );
    connect( exiting      , SIGNAL( triggered() ), this, SLOT(         exit() ) );
    connect( maskExporting, SIGNAL( triggered() ), this, SLOT(   exportMask() ) );
    connect( maskImporting, SIGNAL( triggered() ), this, SLOT(   importMask() ) );

    // -----------------------------------------------------------------

    acquiringObjectsManager->setCheckable( true );
    acquiringPointClouds->setCheckable( true );
    acquiringModelInfo->setCheckable( true );
    acquiringObjectsManager->setCheckable( true );
    acquiringGulsun->setCheckable( true );

#ifndef NO_CRA
    acquiringLocalizer->setCheckable( true );
    acquiringRegistration->setCheckable( true );
#endif

    QMenu* menuView = menuBar()->addMenu( "&View" );
    menuView->addAction( acquiringViewTab );
    menuView->addSeparator();
    menuView->addAction( acquiringObjectsManager );
    menuView->addAction( acquiringPointClouds );
    menuView->addAction( acquiringGulsun );

#ifndef NO_CRA
    menuView->addSeparator();
    menuView->addAction( acquiringLocalizer );
    menuView->addAction( acquiringRegistration );
#endif

    acquiringViewTab       ->setEnabled( false );
    acquiringModelInfo     ->setEnabled( false );
    acquiringObjectsManager->setEnabled( false );
    acquiringPointClouds   ->setEnabled( false );
    acquiringGulsun        ->setEnabled( false );

#ifndef NO_CRA
    acquiringLocalizer   ->setEnabled( false );
    acquiringRegistration->setEnabled( false );
#endif

    acquiringViewTab->setShortcut( QKeySequence::AddTab );
    acquiringGulsun->setShortcut( Qt::Key_F8 );
    acquiringObjectsManager->setShortcut( Qt::Key_F9 );
    acquiringPointClouds->setShortcut( Qt::Key_F10 );

#ifndef NO_CRA
    acquiringLocalizer->setShortcut( Qt::Key_F11 );
    acquiringRegistration->setShortcut( Qt::Key_F12 );
#endif

    connect( acquiringViewTab       , SIGNAL( triggered() ), this, SLOT(           acquireViewTab() ) );
    connect( acquiringModelInfo     , SIGNAL( triggered() ), this, SLOT(         acquireModelInfo() ) );
    connect( acquiringObjectsManager, SIGNAL( triggered() ), this, SLOT(    acquireObjectsManager() ) );
    connect( acquiringPointClouds   , SIGNAL( triggered() ), this, SLOT(       acquirePointClouds() ) );
    connect( acquiringGulsun        , SIGNAL( triggered() ), this, SLOT(            acquireGulsun() ) );

#ifndef NO_CRA
    connect( acquiringLocalizer   , SIGNAL( triggered() ), this, SLOT(    acquireLocalizer() ) );
    connect( acquiringRegistration, SIGNAL( triggered() ), this, SLOT( acquireRegistration() ) );
#endif

    // -----------------------------------------------------------------

    content->addWidget( carnaModelFactory );

    connect( carnaModelFactory, SIGNAL( created( Carna::base::model::Scene* ) ), this, SLOT( init( Carna::base::model::Scene* ) ) );

    tabWidget->setDocumentMode( true );
    content->addWidget( tabWidget );
    this->setCentralWidget( content );

    connect( tabWidget, SIGNAL( tabCloseRequested( int ) ), this, SLOT( tabCloseRequested( int ) ) );
}