comparison audioio/AudioGenerator.cpp @ 180:98ba77e0d897

* Merge from sv-match-alignment branch (excluding alignment-specific document). - add aggregate wave model (not yet complete enough to be added as a true model in a layer, but there's potential) - add play solo mode - add alignment model -- unused in plain SV - fix two plugin leaks - add m3u playlist support (opens all files at once, potentially hazardous) - fix retrieval of pre-encoded URLs - add ability to resample audio files on import, so as to match rates with other files previously loaded; add preference for same - add preliminary support in transform code for range and rate of transform input - reorganise preferences dialog, move dark-background option to preferences, add option for temporary directory location
author Chris Cannam
date Fri, 28 Sep 2007 13:56:38 +0000
parents b4110b17bca8
children ebd906049fb6
comparison
equal deleted inserted replaced
179:dab257bd9d2d 180:98ba77e0d897
45 45
46 //#define DEBUG_AUDIO_GENERATOR 1 46 //#define DEBUG_AUDIO_GENERATOR 1
47 47
48 AudioGenerator::AudioGenerator() : 48 AudioGenerator::AudioGenerator() :
49 m_sourceSampleRate(0), 49 m_sourceSampleRate(0),
50 m_targetChannelCount(1) 50 m_targetChannelCount(1),
51 m_soloing(false)
51 { 52 {
52 connect(PlayParameterRepository::getInstance(), 53 connect(PlayParameterRepository::getInstance(),
53 SIGNAL(playPluginIdChanged(const Model *, QString)), 54 SIGNAL(playPluginIdChanged(const Model *, QString)),
54 this, 55 this,
55 SLOT(playPluginIdChanged(const Model *, QString))); 56 SLOT(playPluginIdChanged(const Model *, QString)));
350 AudioGenerator::getBlockSize() const 351 AudioGenerator::getBlockSize() const
351 { 352 {
352 return m_pluginBlockSize; 353 return m_pluginBlockSize;
353 } 354 }
354 355
356 void
357 AudioGenerator::setSoloModelSet(std::set<Model *> s)
358 {
359 QMutexLocker locker(&m_mutex);
360
361 std::cerr << "setting solo set" << std::endl;
362
363 m_soloModelSet = s;
364 m_soloing = true;
365 }
366
367 void
368 AudioGenerator::clearSoloModelSet()
369 {
370 QMutexLocker locker(&m_mutex);
371
372 m_soloModelSet.clear();
373 m_soloing = false;
374 }
375
355 size_t 376 size_t
356 AudioGenerator::mixModel(Model *model, size_t startFrame, size_t frameCount, 377 AudioGenerator::mixModel(Model *model, size_t startFrame, size_t frameCount,
357 float **buffer, size_t fadeIn, size_t fadeOut) 378 float **buffer, size_t fadeIn, size_t fadeOut)
358 { 379 {
359 if (m_sourceSampleRate == 0) { 380 if (m_sourceSampleRate == 0) {
371 if (!playing) { 392 if (!playing) {
372 #ifdef DEBUG_AUDIO_GENERATOR 393 #ifdef DEBUG_AUDIO_GENERATOR
373 std::cout << "AudioGenerator::mixModel(" << model << "): muted" << std::endl; 394 std::cout << "AudioGenerator::mixModel(" << model << "): muted" << std::endl;
374 #endif 395 #endif
375 return frameCount; 396 return frameCount;
397 }
398
399 if (m_soloing) {
400 if (m_soloModelSet.find(model) == m_soloModelSet.end()) {
401 #ifdef DEBUG_AUDIO_GENERATOR
402 std::cout << "AudioGenerator::mixModel(" << model << "): not one of the solo'd models" << std::endl;
403 #endif
404 return frameCount;
405 }
376 } 406 }
377 407
378 float gain = parameters->getPlayGain(); 408 float gain = parameters->getPlayGain();
379 float pan = parameters->getPlayPan(); 409 float pan = parameters->getPlayPan();
380 410