Mercurial > hg > svapp
changeset 499:a4d90cf2bb79 3.0-integration
Merge from recording branch
author | Chris Cannam |
---|---|
date | Mon, 12 Oct 2015 12:43:06 +0100 |
parents | 111e976f9ed4 (current diff) cd9dec2f47e8 (diff) |
children | dcd2afbc1bb7 |
files | framework/MainWindowBase.cpp |
diffstat | 5 files changed, 23 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/audio/AudioCallbackPlaySource.cpp Thu Sep 17 13:46:07 2015 +0100 +++ b/audio/AudioCallbackPlaySource.cpp Mon Oct 12 12:43:06 2015 +0100 @@ -407,6 +407,8 @@ void AudioCallbackPlaySource::play(sv_frame_t startFrame) { + if (m_target) m_target->resume(); + if (!m_sourceSampleRate) { cerr << "AudioCallbackPlaySource::play: No source sample rate available, not playing" << endl; return; @@ -518,6 +520,8 @@ (m_lastCurrentFrame, m_sourceSampleRate).toText().c_str())); } m_lastCurrentFrame = 0; + + if (m_target) m_target->suspend(); } void
--- a/audio/AudioCallbackPlaySource.h Thu Sep 17 13:46:07 2015 +0100 +++ b/audio/AudioCallbackPlaySource.h Mon Oct 12 12:43:06 2015 +0100 @@ -116,8 +116,7 @@ virtual sv_frame_t getPlayEndFrame() { return m_lastModelEndFrame; } /** - * Set the playback target. This should be called by the target - * class. + * Set the playback target. */ virtual void setSystemPlaybackTarget(breakfastquay::SystemPlaybackTarget *);
--- a/audio/AudioRecordTarget.cpp Thu Sep 17 13:46:07 2015 +0100 +++ b/audio/AudioRecordTarget.cpp Mon Oct 12 12:43:06 2015 +0100 @@ -19,11 +19,14 @@ #include "data/model/WritableWaveFileModel.h" +#include <bqaudioio/SystemRecordSource.h> + #include <QDir> AudioRecordTarget::AudioRecordTarget(ViewManagerBase *manager, QString clientName) : m_viewManager(manager), + m_source(0), m_clientName(clientName.toUtf8().data()), m_recording(false), m_recordSampleRate(44100), @@ -38,6 +41,12 @@ } void +AudioRecordTarget::setSystemRecordSource(breakfastquay::SystemRecordSource *s) +{ + m_source = s; +} + +void AudioRecordTarget::setSystemRecordBlockSize(int sz) { } @@ -113,8 +122,11 @@ WritableWaveFileModel * AudioRecordTarget::startRecording() { + if (m_source) m_source->resume(); + { QMutexLocker locker(&m_mutex); + if (m_recording) { cerr << "WARNING: AudioRecordTarget::startRecording: We are already recording" << endl; return 0; @@ -169,6 +181,8 @@ m_recording = false; } + if (m_source) m_source->suspend(); + emit recordStatusChanged(false); }
--- a/audio/AudioRecordTarget.h Thu Sep 17 13:46:07 2015 +0100 +++ b/audio/AudioRecordTarget.h Mon Oct 12 12:43:06 2015 +0100 @@ -41,6 +41,8 @@ virtual int getApplicationSampleRate() const { return 0; } // don't care virtual int getApplicationChannelCount() const { return 2; } + virtual void setSystemRecordSource(breakfastquay::SystemRecordSource *); + virtual void setSystemRecordBlockSize(int); virtual void setSystemRecordSampleRate(int); virtual void setSystemRecordLatency(int); @@ -66,6 +68,7 @@ private: ViewManagerBase *m_viewManager; + breakfastquay::SystemRecordSource *m_source; std::string m_clientName; bool m_recording; sv_samplerate_t m_recordSampleRate;
--- a/framework/MainWindowBase.cpp Thu Sep 17 13:46:07 2015 +0100 +++ b/framework/MainWindowBase.cpp Mon Oct 12 12:43:06 2015 +0100 @@ -2200,6 +2200,7 @@ createCallbackIO(m_recordTarget, m_playSource); m_audioIO->suspend(); // start in suspended state m_playSource->setSystemPlaybackTarget(m_audioIO); + m_recordTarget->setSystemRecordSource(m_audioIO); } else { m_playTarget = breakfastquay::AudioFactory:: createCallbackPlayTarget(m_playSource); @@ -2660,7 +2661,6 @@ QAction *action = qobject_cast<QAction *>(sender()); if (action) action->setChecked(false); } else { - if (m_audioIO) m_audioIO->resume(); playbackFrameChanged(m_viewManager->getPlaybackFrame()); m_playSource->play(m_viewManager->getPlaybackFrame()); } @@ -2692,8 +2692,6 @@ if (!checkSaveModified()) return; } - if (m_audioIO) m_audioIO->resume(); - WritableWaveFileModel *model = m_recordTarget->startRecording(); if (!model) { cerr << "ERROR: MainWindowBase::record: Recording failed" << endl; @@ -3025,8 +3023,6 @@ m_playSource->stop(); - if (m_audioIO) m_audioIO->suspend(); - if (m_paneStack && m_paneStack->getCurrentPane()) { updateVisibleRangeDisplay(m_paneStack->getCurrentPane()); } else {