comparison audioio/AudioCallbackPlaySource.cpp @ 38:54287e5e7451 sv1-v0.9rc1 sv1-v0.9rc2

* Make vertical scale alignment modes work in note layer as well as time-value layer, and several significant fixes to it * Make it possible to draw notes properly on the note layer * Show units (and frequencies etc in note layer's case) in the time-value and note layer description boxes * Minor fix to item edit dialog layout * Some minor menu rearrangement * Comment out a lot of debug output * Add SV website and reference URLs to Help menu, and add code to (attempt to) open them in the user's preferred browser
author Chris Cannam
date Fri, 12 May 2006 14:40:43 +0000
parents f6b15e0b6fde
children 4ed2448582cc
comparison
equal deleted inserted replaced
37:58cf1620d6e3 38:54287e5e7451
114 if (dtvm) modelChannels = dtvm->getChannelCount(); 114 if (dtvm) modelChannels = dtvm->getChannelCount();
115 if (modelChannels > m_sourceChannelCount) { 115 if (modelChannels > m_sourceChannelCount) {
116 m_sourceChannelCount = modelChannels; 116 m_sourceChannelCount = modelChannels;
117 } 117 }
118 118
119 std::cerr << "Adding model with " << modelChannels << " channels " << std::endl; 119 // std::cerr << "Adding model with " << modelChannels << " channels " << std::endl;
120 120
121 if (m_sourceSampleRate == 0) { 121 if (m_sourceSampleRate == 0) {
122 122
123 m_sourceSampleRate = model->getSampleRate(); 123 m_sourceSampleRate = model->getSampleRate();
124 srChanged = true; 124 srChanged = true;
209 } 209 }
210 210
211 size_t lastEnd = 0; 211 size_t lastEnd = 0;
212 for (std::set<Model *>::const_iterator i = m_models.begin(); 212 for (std::set<Model *>::const_iterator i = m_models.begin();
213 i != m_models.end(); ++i) { 213 i != m_models.end(); ++i) {
214 std::cerr << "AudioCallbackPlaySource::removeModel(" << model << "): checking end frame on model " << *i << std::endl; 214 // std::cerr << "AudioCallbackPlaySource::removeModel(" << model << "): checking end frame on model " << *i << std::endl;
215 if ((*i)->getEndFrame() > lastEnd) lastEnd = (*i)->getEndFrame(); 215 if ((*i)->getEndFrame() > lastEnd) lastEnd = (*i)->getEndFrame();
216 std::cerr << "(done, lastEnd now " << lastEnd << ")" << std::endl; 216 // std::cerr << "(done, lastEnd now " << lastEnd << ")" << std::endl;
217 } 217 }
218 m_lastModelEndFrame = lastEnd; 218 m_lastModelEndFrame = lastEnd;
219 219
220 m_mutex.unlock(); 220 m_mutex.unlock();
221 221
275 275
276 for (size_t i = 0; i < count; ++i) { 276 for (size_t i = 0; i < count; ++i) {
277 m_writeBuffers->push_back(new RingBuffer<float>(m_ringBufferSize)); 277 m_writeBuffers->push_back(new RingBuffer<float>(m_ringBufferSize));
278 } 278 }
279 279
280 std::cerr << "AudioCallbackPlaySource::clearRingBuffers: Created " 280 // std::cerr << "AudioCallbackPlaySource::clearRingBuffers: Created "
281 << count << " write buffers" << std::endl; 281 // << count << " write buffers" << std::endl;
282 282
283 if (!haveLock) { 283 if (!haveLock) {
284 m_mutex.unlock(); 284 m_mutex.unlock();
285 //!!! m_condition.wakeAll();
286 } 285 }
287 } 286 }
288 287
289 void 288 void
290 AudioCallbackPlaySource::play(size_t startFrame) 289 AudioCallbackPlaySource::play(size_t startFrame)
376 } 375 }
377 376
378 void 377 void
379 AudioCallbackPlaySource::setTargetBlockSize(size_t size) 378 AudioCallbackPlaySource::setTargetBlockSize(size_t size)
380 { 379 {
381 std::cerr << "AudioCallbackPlaySource::setTargetBlockSize() -> " << size << std::endl; 380 // std::cerr << "AudioCallbackPlaySource::setTargetBlockSize() -> " << size << std::endl;
382 assert(size < m_ringBufferSize); 381 assert(size < m_ringBufferSize);
383 m_blockSize = size; 382 m_blockSize = size;
384 } 383 }
385 384
386 size_t 385 size_t
387 AudioCallbackPlaySource::getTargetBlockSize() const 386 AudioCallbackPlaySource::getTargetBlockSize() const
388 { 387 {
389 std::cerr << "AudioCallbackPlaySource::getTargetBlockSize() -> " << m_blockSize << std::endl; 388 // std::cerr << "AudioCallbackPlaySource::getTargetBlockSize() -> " << m_blockSize << std::endl;
390 return m_blockSize; 389 return m_blockSize;
391 } 390 }
392 391
393 void 392 void
394 AudioCallbackPlaySource::setTargetPlayLatency(size_t latency) 393 AudioCallbackPlaySource::setTargetPlayLatency(size_t latency)
593 size_t factor, 592 size_t factor,
594 size_t blockSize) : 593 size_t blockSize) :
595 m_factor(factor), 594 m_factor(factor),
596 m_blockSize(blockSize) 595 m_blockSize(blockSize)
597 { 596 {
598 std::cerr << "TimeStretcherData::TimeStretcherData(" << channels << ", " << factor << ", " << blockSize << ")" << std::endl; 597 // std::cerr << "TimeStretcherData::TimeStretcherData(" << channels << ", " << factor << ", " << blockSize << ")" << std::endl;
599 598
600 for (size_t ch = 0; ch < channels; ++ch) { 599 for (size_t ch = 0; ch < channels; ++ch) {
601 m_stretcher[ch] = StretcherBuffer 600 m_stretcher[ch] = StretcherBuffer
602 //!!! We really need to measure performance and work out 601 //!!! We really need to measure performance and work out
603 //what sort of quality level to use -- or at least to 602 //what sort of quality level to use -- or at least to
608 m_stretchInputBuffer = new double[blockSize]; 607 m_stretchInputBuffer = new double[blockSize];
609 } 608 }
610 609
611 AudioCallbackPlaySource::TimeStretcherData::~TimeStretcherData() 610 AudioCallbackPlaySource::TimeStretcherData::~TimeStretcherData()
612 { 611 {
613 std::cerr << "IntegerTimeStretcher::~IntegerTimeStretcher" << std::endl; 612 // std::cerr << "TimeStretcherData::~TimeStretcherData" << std::endl;
614 613
615 while (!m_stretcher.empty()) { 614 while (!m_stretcher.empty()) {
616 delete m_stretcher.begin()->second.first; 615 delete m_stretcher.begin()->second.first;
617 delete[] m_stretcher.begin()->second.second; 616 delete[] m_stretcher.begin()->second.second;
618 m_stretcher.erase(m_stretcher.begin()); 617 m_stretcher.erase(m_stretcher.begin());
1173 } 1172 }
1174 1173
1175 m_bufferScavenger.claim(m_readBuffers); 1174 m_bufferScavenger.claim(m_readBuffers);
1176 m_readBuffers = m_writeBuffers; 1175 m_readBuffers = m_writeBuffers;
1177 m_readBufferFill = m_writeBufferFill; 1176 m_readBufferFill = m_writeBufferFill;
1178 std::cerr << "unified" << std::endl; 1177 // std::cerr << "unified" << std::endl;
1179 } 1178 }
1180 1179
1181 void 1180 void
1182 AudioCallbackPlaySource::AudioCallbackPlaySourceFillThread::run() 1181 AudioCallbackPlaySource::AudioCallbackPlaySourceFillThread::run()
1183 { 1182 {