void MainWindow::on_btnRead_clicked()
{

    btnBrowse->setEnabled(false);
    this->setCursor(Qt::WaitCursor);
    qApp->processEvents();
    myStatusBar->showMessage(tr("Reading record file.."));
    clsRecFile recFile(this->strRecFile);
    int totleCompent =  recFile.getRecordCout();


    myStatusBar->showMessage(tr("Reading data file.."));
    clsDataFile dataFile(this->strDataFile,totleCompent);
    QList<DATA_FILE> dataRes = dataFile.getRes();
    clsDbOp::getInst()->emptyMainSheet();
    clsDbOp::getInst()->fillMainSheet(dataRes);


    myStatusBar->showMessage(tr("Reading step file.."));
    clsStepFile stepFile(this->strStepFile);
    stepFile.setTotleComp(dataRes.length());
    QList<STEP_FILE>stepRes = stepFile.getStepData();
    clsDbOp::getInst()->emptyDetailSheet();
    clsDbOp::getInst()->fillDetailSheet(stepRes);

    double x =(1.0*clsDbOp::getInst()->getComponent().length()/1000.0);

    if(ceil(x)!=x)
        x++;

    txtPage->setMaximum((int)x);
    txtPage->setValue(1);


    showStatistics(clsDbOp::getInst()->getComponent(All).length(),
                   clsDbOp::getInst()->getComponent(Pass).length(),
                   clsDbOp::getInst()->getComponent(Fail).length());


    mainSelectMode = All;
    stepSelectMode = All;
    rbMainAll->setChecked(true);
    rbStepAll->setChecked(true);

    myStatusBar->showMessage(tr("Creating MainSheet data sheet .."));
    fillMainSheet(1);
    myStatusBar->showMessage(tr("Creating DetailSheet data sheet .."));
    fillStepSheet();
    myStatusBar->showMessage(tr("Done"));
    btnBrowse->setEnabled(true);


    this->setCursor(Qt::ArrowCursor);
    qApp->processEvents();
}
Exemple #2
0
void WaveTrack::setChannels(int n)
      {
      AudioTrack::setChannels(n);
      SndFileR sf = recFile();
      if (sf) {
            if (sf->samples() == 0) {
                  sf->remove();
                  sf->setFormat(sf->format(), _channels,
                     sf->samplerate());
                  sf->openWrite();
                  }
            }
      }
Exemple #3
0
bool RecBookFile::ExportPages( int exportType )
{
    
    wxArrayString paths, filenames;
	size_t nbOfFiles;
    int i;
    
    wxString outputDir = wxDirSelector( _("Output folder"), wxGetApp().m_lastDirBatch_out );
    if ( outputDir.empty() )
        return false;
    wxGetApp().m_lastDirBatch_out = outputDir;
        
	nbOfFiles = RecognizedFiles( &filenames, &paths );
    
    for ( i = 0; i < (int)nbOfFiles; i++ )
    {
        RecFile recFile( "rec_book_export" );
        recFile.New();
        
        if ( !recFile.Open( paths[i] ) )
            return false;
        
        if ( !recFile.IsRecognized() ) 
        {
            wxLogWarning(_("File '%s' skipped"), paths[i].c_str() );
            continue;
        }
        
        wxString out = outputDir + wxFileName::GetPathSeparator() + recFile.m_shortname;
        
        MusFileOutputStream *outStream = NULL;
        switch( exportType ) {
            case ( REC_BOOK_EXPORT_MEI ): outStream = new MusMeiOutput( recFile.m_musDocPtr, out + ".mei" ); break;
        }
        if ( outStream ) {
            outStream->ExportFile();
            delete outStream;
        }
    }
    
    return true;
}
Exemple #4
0
bool WaveTrack::getData(unsigned framePos, int channels, unsigned nframe, float** bp)
      {
      bool have_data = false;
      if ((MusEGlobal::song->bounceTrack != this) && !noInRoute()) {
            RouteList* irl = inRoutes();
            for(ciRoute i = irl->begin(); i != irl->end(); ++i)
            {
              if(i->track->isMidiTrack())
                continue;

              ((AudioTrack*)i->track)->copyData(framePos, channels,
                                               i->channel,
                                               i->channels,
                                               nframe, bp, have_data);
              have_data = true;
            }
            
            if (recordFlag()) {
            //if (have_data && recordFlag()) {
                  //if (MusEGlobal::audio->isRecording() && recFile()) {
                  if (have_data && MusEGlobal::audio->isRecording() && recFile()) {
                        if (MusEGlobal::audio->freewheel()) {
                              }
                        else {
#ifdef _AUDIO_USE_TRUE_FRAME_
                              // TODO: Tested: This is the line that would be needed for Audio Inputs, 
                              //  because the data arrived in the previous period! Test OK, the waves are in sync.
                              // So we need to do Audio Inputs separately above, AND find a way to mix two overlapping
                              //  periods into the file! Nothing wrong with the FIFO per se, we could stamp overlapping
                              //  times. But the soundfile just writes, does not mix.
                              //if (fifo.put(channels, nframe, bp, MusEGlobal::audio->previousPos().frame()))
                              //
                              // Tested: This line is OK for track-to-track recording, the waves are in sync:
#endif                              
                              if (fifo.put(channels, nframe, bp, MusEGlobal::audio->pos().frame()))  
                                    printf("WaveTrack::getData(%d, %d, %d): fifo overrun\n",
                                       framePos, channels, nframe);
                              }
                        }
                  //return true;  // REMOVE Tim. Can't hear existing parts while recording, even while simply armed.
                  // FIXME TODO Remove this. But first code below needs to become ADDITIVE/REPLACING (don't just take over buffers).
                  return have_data;  
                  }
            }
      if (!MusEGlobal::audio->isPlaying())
            return false;
            //return have_data;
      
      if (MusEGlobal::audio->freewheel()) {

            // when freewheeling, read data direct from file:
            // Indicate do not seek file before each read.
            fetchData(framePos, nframe, bp, false);

            }
      else {
            unsigned pos;
            if (_prefetchFifo.get(channels, nframe, bp, &pos)) {
                  printf("WaveTrack::getData(%s) fifo underrun\n",
                      name().toLocal8Bit().constData());
                  return false;
                  }
            if (pos != framePos) {
                  if (MusEGlobal::debugMsg)
                        printf("fifo get error expected %d, got %d\n",
                            framePos, pos);
                  while (pos < framePos) {
                        if (_prefetchFifo.get(channels, nframe, bp, &pos)) {
                              printf("WaveTrack::getData(%s) fifo underrun\n",
                                  name().toLocal8Bit().constData());
                              return false;
                              }
                        }
                  }
            }
      return true;
      }
void firstPage::setUp_RecTable(){

    recTable=ui->recTable;
    recTable->verticalHeader()->setVisible(false);
    recTable->horizontalHeader()->setVisible(false);
    recTable->setShowGrid(false);

    //Format 1. Column
    for(int i = 0; i<recTable->rowCount() ; i++)
    {
        recTable->item(i,0)->setTextAlignment(Qt::AlignRight | Qt::AlignVCenter);
    }

    //////////////////////////////////////////////////////////
    //      Put DoubleSpinBoxes in 2.Column of Table        //
    //////////////////////////////////////////////////////////
    for( int i = 0; i < recTable->rowCount(); i++ )
    {

        QDoubleSpinBox *spinBox = new QDoubleSpinBox();
        spinBox->setValue(0);
        recTable->setCellWidget( i, 1, spinBox );

    }

    //Format SpinBoxes Manually

    static_cast<QSpinBox*>(recTable->cellWidget(0,1))->setMinimum(0);
    static_cast<QSpinBox*>(recTable->cellWidget(0,1))->setMaximum(maxA);

    static_cast<QSpinBox*>(recTable->cellWidget(1,1))->setMinimum(0);
    static_cast<QSpinBox*>(recTable->cellWidget(1,1))->setMaximum(maxA);

    static_cast<QSpinBox*>(recTable->cellWidget(2,1))->setMinimum(-1000);
    static_cast<QSpinBox*>(recTable->cellWidget(2,1))->setMaximum(1000);

    static_cast<QSpinBox*>(recTable->cellWidget(3,1))->setMinimum(-1000);
    static_cast<QSpinBox*>(recTable->cellWidget(3,1))->setMaximum(1000);

    static_cast<QSpinBox*>(recTable->cellWidget(4,1))->setMinimum(-1000);
    static_cast<QSpinBox*>(recTable->cellWidget(4,1))->setMaximum(1000);

    static_cast<QSpinBox*>(recTable->cellWidget(5,1))->setMinimum(0);
    static_cast<QSpinBox*>(recTable->cellWidget(5,1))->setMaximum(veloMax);

    ////////////////////////////////////////////////////////////////////////
    //      Load stored values and assign them in 3. and 2. Column        //
    ////////////////////////////////////////////////////////////////////////
    cout<<mRectangle.getStoredValuesPath()<<endl;
    QFile recFile(QString::fromStdString(mRectangle.getStoredValuesPath()));
    recFile.open(QIODevice::ReadOnly | QIODevice::Text);

    QTextStream inRec(&recFile);
    for( int i = 0; i < recTable->rowCount(); i++ )
    {
        QLabel *label = new QLabel();
        double x = inRec.readLine().toDouble();

        if((i==2)||(i==3)||(i==4)){
            x=(x/(2*pi))*360;
        }


        label->setNum(x);
        cout<<x<<endl;
        label->setAlignment(Qt::AlignVCenter);
        recTable->setCellWidget( i, 3, label );
        static_cast<QDoubleSpinBox*>(recTable->cellWidget(i,1))->setValue(x);
    }
    recFile.close();


    //make 1. Column unaccesible
    for(int i = 0;i<recTable->rowCount();i++){

        recTable->item(i,0)->setFlags(recTable->item(i,0)->flags() ^ Qt::ItemIsEditable);
        recTable->item(i,0)->setFlags(recTable->item(i,0)->flags() ^ Qt::ItemIsSelectable);
        recTable->item(i,0)->setFlags(recTable->item(i,0)->flags() ^ Qt::ItemIsUserCheckable);
        //recTable->item(i,0)->setFlags(recTable->item(i,0)->flags() ^ Qt::ItemIsEnabled);
    }


    recTable->setColumnWidth(2,cWidth);
    recTable->setTabKeyNavigation(false);


}