Mercurial > hg > svapp
comparison audio/AudioRecordTarget.cpp @ 498:cd9dec2f47e8 recording
Fix suspending/resuming audio device; it wasn't suspending when playback reached the end, only when the user stopped explicitly
author | Chris Cannam |
---|---|
date | Tue, 22 Sep 2015 17:12:37 +0100 |
parents | 3dbc964f5907 |
children | dcd2afbc1bb7 |
comparison
equal
deleted
inserted
replaced
487:66b92c188cbd | 498:cd9dec2f47e8 |
---|---|
17 #include "base/ViewManagerBase.h" | 17 #include "base/ViewManagerBase.h" |
18 #include "base/TempDirectory.h" | 18 #include "base/TempDirectory.h" |
19 | 19 |
20 #include "data/model/WritableWaveFileModel.h" | 20 #include "data/model/WritableWaveFileModel.h" |
21 | 21 |
22 #include <bqaudioio/SystemRecordSource.h> | |
23 | |
22 #include <QDir> | 24 #include <QDir> |
23 | 25 |
24 AudioRecordTarget::AudioRecordTarget(ViewManagerBase *manager, | 26 AudioRecordTarget::AudioRecordTarget(ViewManagerBase *manager, |
25 QString clientName) : | 27 QString clientName) : |
26 m_viewManager(manager), | 28 m_viewManager(manager), |
29 m_source(0), | |
27 m_clientName(clientName.toUtf8().data()), | 30 m_clientName(clientName.toUtf8().data()), |
28 m_recording(false), | 31 m_recording(false), |
29 m_recordSampleRate(44100), | 32 m_recordSampleRate(44100), |
30 m_frameCount(0), | 33 m_frameCount(0), |
31 m_model(0) | 34 m_model(0) |
33 } | 36 } |
34 | 37 |
35 AudioRecordTarget::~AudioRecordTarget() | 38 AudioRecordTarget::~AudioRecordTarget() |
36 { | 39 { |
37 QMutexLocker locker(&m_mutex); | 40 QMutexLocker locker(&m_mutex); |
41 } | |
42 | |
43 void | |
44 AudioRecordTarget::setSystemRecordSource(breakfastquay::SystemRecordSource *s) | |
45 { | |
46 m_source = s; | |
38 } | 47 } |
39 | 48 |
40 void | 49 void |
41 AudioRecordTarget::setSystemRecordBlockSize(int sz) | 50 AudioRecordTarget::setSystemRecordBlockSize(int sz) |
42 { | 51 { |
111 } | 120 } |
112 | 121 |
113 WritableWaveFileModel * | 122 WritableWaveFileModel * |
114 AudioRecordTarget::startRecording() | 123 AudioRecordTarget::startRecording() |
115 { | 124 { |
125 if (m_source) m_source->resume(); | |
126 | |
116 { | 127 { |
117 QMutexLocker locker(&m_mutex); | 128 QMutexLocker locker(&m_mutex); |
129 | |
118 if (m_recording) { | 130 if (m_recording) { |
119 cerr << "WARNING: AudioRecordTarget::startRecording: We are already recording" << endl; | 131 cerr << "WARNING: AudioRecordTarget::startRecording: We are already recording" << endl; |
120 return 0; | 132 return 0; |
121 } | 133 } |
122 | 134 |
167 m_model->setCompletion(100); | 179 m_model->setCompletion(100); |
168 m_model = 0; | 180 m_model = 0; |
169 m_recording = false; | 181 m_recording = false; |
170 } | 182 } |
171 | 183 |
184 if (m_source) m_source->suspend(); | |
185 | |
172 emit recordStatusChanged(false); | 186 emit recordStatusChanged(false); |
173 } | 187 } |
174 | 188 |
175 | 189 |