Mercurial > hg > svapp
comparison framework/MainWindowBase.cpp @ 478:1f86bf6644b8 recording
Toward recording without something already loaded (needs more work though)
author | Chris Cannam |
---|---|
date | Wed, 19 Aug 2015 16:34:06 +0100 |
parents | 411e019474e5 |
children | 6f475df6f833 |
comparison
equal
deleted
inserted
replaced
477:411e019474e5 | 478:1f86bf6644b8 |
---|---|
567 (currentLayer != 0)); | 567 (currentLayer != 0)); |
568 bool haveMainModel = | 568 bool haveMainModel = |
569 (getMainModel() != 0); | 569 (getMainModel() != 0); |
570 bool havePlayTarget = | 570 bool havePlayTarget = |
571 (m_playTarget != 0 || m_audioIO != 0); | 571 (m_playTarget != 0 || m_audioIO != 0); |
572 bool haveRecordSource = | |
573 (m_audioIO != 0); | |
574 bool haveSelection = | 572 bool haveSelection = |
575 (m_viewManager && | 573 (m_viewManager && |
576 !m_viewManager->getSelections().empty()); | 574 !m_viewManager->getSelections().empty()); |
577 bool haveCurrentEditableLayer = | 575 bool haveCurrentEditableLayer = |
578 (haveCurrentLayer && | 576 (haveCurrentLayer && |
613 emit canEditLayer(haveCurrentEditableLayer); | 611 emit canEditLayer(haveCurrentEditableLayer); |
614 emit canEditLayerTabular(haveCurrentEditableLayer || haveTabularLayer); | 612 emit canEditLayerTabular(haveCurrentEditableLayer || haveTabularLayer); |
615 emit canMeasureLayer(haveCurrentLayer); | 613 emit canMeasureLayer(haveCurrentLayer); |
616 emit canSelect(haveMainModel && haveCurrentPane); | 614 emit canSelect(haveMainModel && haveCurrentPane); |
617 emit canPlay(haveMainModel && havePlayTarget); | 615 emit canPlay(haveMainModel && havePlayTarget); |
618 emit canRecord(haveRecordSource); | 616 emit canRecord(m_soundOptions & WithAudioInput); // always possible then |
619 emit canFfwd(haveMainModel); | 617 emit canFfwd(haveMainModel); |
620 emit canRewind(haveMainModel); | 618 emit canRewind(haveMainModel); |
621 emit canPaste(haveClipboardContents); | 619 emit canPaste(haveClipboardContents); |
622 emit canInsertInstant(haveCurrentPane); | 620 emit canInsertInstant(haveCurrentPane); |
623 emit canInsertInstantsAtBoundaries(haveCurrentPane && haveSelection); | 621 emit canInsertInstantsAtBoundaries(haveCurrentPane && haveSelection); |
2664 } | 2662 } |
2665 | 2663 |
2666 void | 2664 void |
2667 MainWindowBase::record() | 2665 MainWindowBase::record() |
2668 { | 2666 { |
2667 if (!(m_soundOptions & WithAudioInput)) { | |
2668 return; | |
2669 } | |
2670 | |
2669 if (!m_recordTarget) { | 2671 if (!m_recordTarget) { |
2670 //!!! report | 2672 //!!! report |
2671 return; | 2673 return; |
2672 } | 2674 } |
2673 | 2675 |
2676 if (!m_audioIO) { | |
2677 createAudioIO(); | |
2678 } | |
2679 | |
2674 if (m_recordTarget->isRecording()) { | 2680 if (m_recordTarget->isRecording()) { |
2675 m_recordTarget->stopRecording(); | 2681 m_recordTarget->stopRecording(); |
2676 return; | 2682 return; |
2677 } | 2683 } |
2678 | 2684 |
2688 delete model; | 2694 delete model; |
2689 //!!! ??? | 2695 //!!! ??? |
2690 return; | 2696 return; |
2691 } | 2697 } |
2692 | 2698 |
2693 CommandHistory::getInstance()->startCompoundOperation | 2699 PlayParameterRepository::getInstance()->addPlayable(model); |
2694 (tr("Import Recorded Audio"), true); | 2700 |
2695 | 2701 if (!getMainModel()) { |
2696 m_document->addImportedModel(model); | 2702 |
2697 | 2703 m_document->setMainModel(model); |
2698 AddPaneCommand *command = new AddPaneCommand(this); | 2704 setupMenus(); |
2699 CommandHistory::getInstance()->addCommand(command); | 2705 |
2700 | 2706 } else { |
2701 Pane *pane = command->getPane(); | 2707 |
2702 | 2708 CommandHistory::getInstance()->startCompoundOperation |
2703 if (m_timeRulerLayer) { | 2709 (tr("Import Recorded Audio"), true); |
2704 m_document->addLayerToView(pane, m_timeRulerLayer); | 2710 |
2705 } | 2711 m_document->addImportedModel(model); |
2706 | 2712 |
2707 Layer *newLayer = m_document->createImportedLayer(model); | 2713 AddPaneCommand *command = new AddPaneCommand(this); |
2708 | 2714 CommandHistory::getInstance()->addCommand(command); |
2709 if (newLayer) { | 2715 |
2710 m_document->addLayerToView(pane, newLayer); | 2716 Pane *pane = command->getPane(); |
2711 } | 2717 |
2718 if (m_timeRulerLayer) { | |
2719 m_document->addLayerToView(pane, m_timeRulerLayer); | |
2720 } | |
2721 | |
2722 Layer *newLayer = m_document->createImportedLayer(model); | |
2723 | |
2724 if (newLayer) { | |
2725 m_document->addLayerToView(pane, newLayer); | |
2726 } | |
2712 | 2727 |
2713 CommandHistory::getInstance()->endCompoundOperation(); | 2728 CommandHistory::getInstance()->endCompoundOperation(); |
2729 } | |
2714 } | 2730 } |
2715 | 2731 |
2716 void | 2732 void |
2717 MainWindowBase::ffwd() | 2733 MainWindowBase::ffwd() |
2718 { | 2734 { |