Mercurial > hg > svapp
comparison framework/MainWindowBase.cpp @ 618:636a5908cf81 import-audio-data
Merge from default branch
author | Chris Cannam |
---|---|
date | Tue, 04 Sep 2018 13:19:43 +0100 |
parents | 6cdf2afebfd7 37b23e50832b |
children | 0e95c30d6680 |
comparison
equal
deleted
inserted
replaced
604:6cdf2afebfd7 | 618:636a5908cf81 |
---|---|
2467 if (m_soundOptions & WithAudioInput) { | 2467 if (m_soundOptions & WithAudioInput) { |
2468 m_audioIO = breakfastquay::AudioFactory:: | 2468 m_audioIO = breakfastquay::AudioFactory:: |
2469 createCallbackIO(m_recordTarget, m_resamplerWrapper, | 2469 createCallbackIO(m_recordTarget, m_resamplerWrapper, |
2470 preference, errorString); | 2470 preference, errorString); |
2471 if (m_audioIO) { | 2471 if (m_audioIO) { |
2472 SVCERR << "MainWindowBase::createAudioIO: Suspending on creation" << endl; | |
2472 m_audioIO->suspend(); // start in suspended state | 2473 m_audioIO->suspend(); // start in suspended state |
2473 m_playSource->setSystemPlaybackTarget(m_audioIO); | 2474 m_playSource->setSystemPlaybackTarget(m_audioIO); |
2474 } else { | 2475 } else { |
2475 // Failed to create audio I/O; this may just mean there is | 2476 // Failed to create audio I/O; this may just mean there is |
2476 // no record device, so fall through to see what happens | 2477 // no record device, so fall through to see what happens |
2482 if (!m_audioIO) { | 2483 if (!m_audioIO) { |
2483 m_playTarget = breakfastquay::AudioFactory:: | 2484 m_playTarget = breakfastquay::AudioFactory:: |
2484 createCallbackPlayTarget(m_resamplerWrapper, | 2485 createCallbackPlayTarget(m_resamplerWrapper, |
2485 preference, errorString); | 2486 preference, errorString); |
2486 if (m_playTarget) { | 2487 if (m_playTarget) { |
2488 SVCERR << "MainWindowBase::createAudioIO: Suspending on creation" << endl; | |
2487 m_playTarget->suspend(); // start in suspended state | 2489 m_playTarget->suspend(); // start in suspended state |
2488 m_playSource->setSystemPlaybackTarget(m_playTarget); | 2490 m_playSource->setSystemPlaybackTarget(m_playTarget); |
2489 } | 2491 } |
2490 } | 2492 } |
2491 | 2493 |
2559 } | 2561 } |
2560 | 2562 |
2561 void | 2563 void |
2562 MainWindowBase::audioChannelCountIncreased(int) | 2564 MainWindowBase::audioChannelCountIncreased(int) |
2563 { | 2565 { |
2566 SVCERR << "MainWindowBase::audioChannelCountIncreased" << endl; | |
2564 recreateAudioIO(); | 2567 recreateAudioIO(); |
2568 | |
2569 if (m_recordTarget && | |
2570 m_recordTarget->isRecording() && | |
2571 m_audioIO) { | |
2572 SVCERR << "MainWindowBase::audioChannelCountIncreased: we were recording already, so resuming IO now" << endl; | |
2573 m_audioIO->resume(); | |
2574 } | |
2565 } | 2575 } |
2566 | 2576 |
2567 WaveFileModel * | 2577 WaveFileModel * |
2568 MainWindowBase::getMainModel() | 2578 MainWindowBase::getMainModel() |
2569 { | 2579 { |
3037 if (action) action->setChecked(false); | 3047 if (action) action->setChecked(false); |
3038 return; | 3048 return; |
3039 } | 3049 } |
3040 | 3050 |
3041 if (!m_audioIO) { | 3051 if (!m_audioIO) { |
3042 cerr << "MainWindowBase::record: about to create audio IO" << endl; | 3052 SVDEBUG << "MainWindowBase::record: about to create audio IO" << endl; |
3043 createAudioIO(); | 3053 createAudioIO(); |
3044 } | 3054 } |
3045 | 3055 |
3046 if (!m_audioIO) { | 3056 if (!m_audioIO) { |
3047 if (!m_playTarget) { | 3057 if (!m_playTarget) { |
3076 } | 3086 } |
3077 } | 3087 } |
3078 | 3088 |
3079 if (m_viewManager) m_viewManager->setGlobalCentreFrame(0); | 3089 if (m_viewManager) m_viewManager->setGlobalCentreFrame(0); |
3080 | 3090 |
3081 SVDEBUG << "MainWindowBase::record: about to resume" << endl; | 3091 SVCERR << "MainWindowBase::record: about to resume" << endl; |
3082 m_audioIO->resume(); | 3092 m_audioIO->resume(); |
3083 | 3093 |
3084 WritableWaveFileModel *model = m_recordTarget->startRecording(); | 3094 WritableWaveFileModel *model = m_recordTarget->startRecording(); |
3085 if (!model) { | 3095 if (!model) { |
3086 SVCERR << "ERROR: MainWindowBase::record: Recording failed" << endl; | 3096 SVCERR << "ERROR: MainWindowBase::record: Recording failed" << endl; |
3090 if (action) action->setChecked(false); | 3100 if (action) action->setChecked(false); |
3091 return; | 3101 return; |
3092 } | 3102 } |
3093 | 3103 |
3094 if (!model->isOK()) { | 3104 if (!model->isOK()) { |
3105 SVCERR << "MainWindowBase::record: Model not OK, stopping and suspending" << endl; | |
3095 m_recordTarget->stopRecording(); | 3106 m_recordTarget->stopRecording(); |
3096 m_audioIO->suspend(); | 3107 m_audioIO->suspend(); |
3097 if (action) action->setChecked(false); | 3108 if (action) action->setChecked(false); |
3098 delete model; | 3109 delete model; |
3099 return; | 3110 return; |
3100 } | 3111 } |
3112 | |
3113 SVCERR << "MainWindowBase::record: Model is OK, continuing..." << endl; | |
3101 | 3114 |
3102 PlayParameterRepository::getInstance()->addPlayable(model); | 3115 PlayParameterRepository::getInstance()->addPlayable(model); |
3103 | 3116 |
3104 if (m_audioRecordMode == RecordReplaceSession || !getMainModel()) { | 3117 if (m_audioRecordMode == RecordReplaceSession || !getMainModel()) { |
3105 | 3118 |
3109 bool loadedTemplate = false; | 3122 bool loadedTemplate = false; |
3110 | 3123 |
3111 if (templateName != "") { | 3124 if (templateName != "") { |
3112 FileOpenStatus tplStatus = openSessionTemplate(templateName); | 3125 FileOpenStatus tplStatus = openSessionTemplate(templateName); |
3113 if (tplStatus == FileOpenCancelled) { | 3126 if (tplStatus == FileOpenCancelled) { |
3127 SVCERR << "MainWindowBase::record: Session template open cancelled, stopping and suspending" << endl; | |
3114 m_recordTarget->stopRecording(); | 3128 m_recordTarget->stopRecording(); |
3115 m_audioIO->suspend(); | 3129 m_audioIO->suspend(); |
3116 PlayParameterRepository::getInstance()->removePlayable(model); | 3130 PlayParameterRepository::getInstance()->removePlayable(model); |
3117 return; | 3131 return; |
3118 } | 3132 } |
3181 } | 3195 } |
3182 | 3196 |
3183 updateMenuStates(); | 3197 updateMenuStates(); |
3184 m_recentFiles.addFile(model->getLocation()); | 3198 m_recentFiles.addFile(model->getLocation()); |
3185 currentPaneChanged(m_paneStack->getCurrentPane()); | 3199 currentPaneChanged(m_paneStack->getCurrentPane()); |
3186 | 3200 |
3187 emit audioFileLoaded(); | 3201 emit audioFileLoaded(); |
3188 } | 3202 } |
3189 | 3203 |
3190 void | 3204 void |
3191 MainWindowBase::ffwd() | 3205 MainWindowBase::ffwd() |
3422 | 3436 |
3423 if (!m_playSource) return; | 3437 if (!m_playSource) return; |
3424 | 3438 |
3425 m_playSource->stop(); | 3439 m_playSource->stop(); |
3426 | 3440 |
3441 SVCERR << "MainWindowBase::stop: suspending" << endl; | |
3442 | |
3427 if (m_audioIO) m_audioIO->suspend(); | 3443 if (m_audioIO) m_audioIO->suspend(); |
3428 else if (m_playTarget) m_playTarget->suspend(); | 3444 else if (m_playTarget) m_playTarget->suspend(); |
3429 | 3445 |
3430 if (m_paneStack && m_paneStack->getCurrentPane()) { | 3446 if (m_paneStack && m_paneStack->getCurrentPane()) { |
3431 updateVisibleRangeDisplay(m_paneStack->getCurrentPane()); | 3447 updateVisibleRangeDisplay(m_paneStack->getCurrentPane()); |
4060 path = path.replace('/', '\\'); | 4076 path = path.replace('/', '\\'); |
4061 args << path; | 4077 args << path; |
4062 QProcess::execute("c:/windows/explorer.exe", args); | 4078 QProcess::execute("c:/windows/explorer.exe", args); |
4063 #else | 4079 #else |
4064 args << path; | 4080 args << path; |
4065 QProcess::execute( | 4081 QProcess process; |
4082 QProcessEnvironment env = QProcessEnvironment::systemEnvironment(); | |
4083 env.insert("LD_LIBRARY_PATH", ""); | |
4084 process.setProcessEnvironment(env); | |
4085 process.start( | |
4066 #if defined Q_OS_MAC | 4086 #if defined Q_OS_MAC |
4067 "/usr/bin/open", | 4087 "/usr/bin/open", |
4068 #else | 4088 #else |
4069 "/usr/bin/xdg-open", | 4089 "/usr/bin/xdg-open", |
4070 #endif | 4090 #endif |
4071 args); | 4091 args); |
4092 process.waitForFinished(); | |
4072 #endif | 4093 #endif |
4073 } | 4094 } |
4074 } | 4095 } |
4075 | 4096 |