comparison audioio/AudioCallbackPlaySource.cpp @ 158:72495c4cd315

* Add vestigial Activity Log
author Chris Cannam
date Tue, 24 Feb 2009 14:01:42 +0000
parents 3b61a975b47e
children 2c158dd3b983
comparison
equal deleted inserted replaced
157:ae56bf90cdf9 158:72495c4cd315
425 bool changed = !m_playing; 425 bool changed = !m_playing;
426 m_lastRetrievalTimestamp = 0; 426 m_lastRetrievalTimestamp = 0;
427 m_lastCurrentFrame = 0; 427 m_lastCurrentFrame = 0;
428 m_playing = true; 428 m_playing = true;
429 m_condition.wakeAll(); 429 m_condition.wakeAll();
430 if (changed) emit playStatusChanged(m_playing); 430 if (changed) {
431 emit playStatusChanged(m_playing);
432 emit activity(tr("Play from %1").arg
433 (RealTime::frame2RealTime
434 (m_playStartFrame, m_sourceSampleRate).toText().c_str()));
435 }
431 } 436 }
432 437
433 void 438 void
434 AudioCallbackPlaySource::stop() 439 AudioCallbackPlaySource::stop()
435 { 440 {
436 bool changed = m_playing; 441 bool changed = m_playing;
437 m_playing = false; 442 m_playing = false;
438 m_condition.wakeAll(); 443 m_condition.wakeAll();
439 m_lastRetrievalTimestamp = 0; 444 m_lastRetrievalTimestamp = 0;
445 if (changed) {
446 emit playStatusChanged(m_playing);
447 emit activity(tr("Stop at %1").arg
448 (RealTime::frame2RealTime
449 (m_lastCurrentFrame, m_sourceSampleRate).toText().c_str()));
450 }
440 m_lastCurrentFrame = 0; 451 m_lastCurrentFrame = 0;
441 if (changed) emit playStatusChanged(m_playing);
442 } 452 }
443 453
444 void 454 void
445 AudioCallbackPlaySource::selectionChanged() 455 AudioCallbackPlaySource::selectionChanged()
446 { 456 {
971 { 981 {
972 m_stretchRatio = factor; 982 m_stretchRatio = factor;
973 983
974 if (m_timeStretcher || (factor == 1.f)) { 984 if (m_timeStretcher || (factor == 1.f)) {
975 // stretch ratio will be set in next process call if appropriate 985 // stretch ratio will be set in next process call if appropriate
976 return;
977 } else { 986 } else {
978 m_stretcherInputCount = getTargetChannelCount(); 987 m_stretcherInputCount = getTargetChannelCount();
979 RubberBandStretcher *stretcher = new RubberBandStretcher 988 RubberBandStretcher *stretcher = new RubberBandStretcher
980 (getTargetSampleRate(), 989 (getTargetSampleRate(),
981 m_stretcherInputCount, 990 m_stretcherInputCount,
992 m_stretcherInputSizes[c] = 16384; 1001 m_stretcherInputSizes[c] = 16384;
993 m_stretcherInputs[c] = new float[m_stretcherInputSizes[c]]; 1002 m_stretcherInputs[c] = new float[m_stretcherInputSizes[c]];
994 } 1003 }
995 m_monoStretcher = monoStretcher; 1004 m_monoStretcher = monoStretcher;
996 m_timeStretcher = stretcher; 1005 m_timeStretcher = stretcher;
997 return; 1006 }
998 } 1007
1008 emit activity(tr("Change time-stretch factor to %1").arg(factor));
999 } 1009 }
1000 1010
1001 size_t 1011 size_t
1002 AudioCallbackPlaySource::getSourceSamples(size_t ucount, float **buffer) 1012 AudioCallbackPlaySource::getSourceSamples(size_t ucount, float **buffer)
1003 { 1013 {