Logo Search packages:      
Sourcecode: canorus version File versions  Download package

void CAMainWin::on_uiPlayFromSelection_toggled ( bool  checked  )  [private, slot]

Connected with the play button which starts the playback.

Definition at line 2588 of file mainwin.cpp.

References _playbackViewPort, CAScoreViewPort::clearSelection(), onRepaintTimerTimeout(), playbackFinished(), CAScoreViewPort::selection(), CAScoreViewPort::setBorder(), CAPlayback::setInitTimeStart(), CAScoreViewPort::setPlaying(), and CAPlayback::stop().

                                                           {
      if (checked && currentScoreViewPort() && !_playback) {
            _repaintTimer = new QTimer();
            _repaintTimer->setInterval(100);
            _repaintTimer->start();
            //connect(_repaintTimer, SIGNAL(timeout()), this, SLOT(on_repaintTimer_timeout())); //TODO: timeout is connected directly to repaint() directly. This should be optimized in the future -Matevz
            connect( _repaintTimer, SIGNAL(timeout()), this, SLOT( onRepaintTimerTimeout() ) );

            CACanorus::midiDevice()->openOutputPort( CACanorus::settings()->midiOutPort() );
            _playback = new CAPlayback(currentSheet(), CACanorus::midiDevice() );
            if ( currentScoreViewPort()->selection().size() && currentScoreViewPort()->selection().at(0)->musElement() )
                  _playback->setInitTimeStart( currentScoreViewPort()->selection().at(0)->musElement()->timeStart() );

            connect(_playback, SIGNAL(playbackFinished()), this, SLOT(playbackFinished()));

            QPen p;
            p.setColor(Qt::green);
            p.setWidth(3);

            _playbackViewPort = currentViewPort();
            currentScoreViewPort()->setBorder(p);
            currentScoreViewPort()->setPlaying(true); // set the deadlock for borders

            // Remember old selection
            _prePlaybackSelection = currentScoreViewPort()->selection();
            currentScoreViewPort()->clearSelection();

            _playback->start();
      } else if(_playback) {
            _playback->stop();
      }
}


Generated by  Doxygen 1.6.0   Back to index