amuse/lib/Studio.cpp

35 lines
982 B
C++
Raw Normal View History

#include "amuse/Studio.hpp"
#include "amuse/Engine.hpp"
2018-12-08 05:20:09 +00:00
namespace amuse {
#ifndef NDEBUG
2018-12-08 05:20:09 +00:00
bool Studio::_cyclicCheck(Studio* leaf) {
for (auto it = m_studiosOut.begin(); it != m_studiosOut.end();) {
if (leaf == it->m_targetStudio.get() || it->m_targetStudio->_cyclicCheck(leaf))
return true;
++it;
}
return false;
}
#endif
2018-12-08 05:20:09 +00:00
Studio::Studio(Engine& engine, bool mainOut) : m_engine(engine), m_master(engine), m_auxA(engine), m_auxB(engine) {
if (mainOut && engine.m_defaultStudioReady)
addStudioSend(engine.getDefaultStudio(), 1.f, 1.f, 1.f);
}
2018-12-08 05:20:09 +00:00
void Studio::addStudioSend(ObjToken<Studio> studio, float dry, float auxA, float auxB) {
m_studiosOut.emplace_back(studio, dry, auxA, auxB);
2016-07-14 04:54:46 +00:00
2018-12-08 05:20:09 +00:00
/* Cyclic check */
assert(!_cyclicCheck(this));
}
2018-12-08 05:20:09 +00:00
void Studio::resetOutputSampleRate(double sampleRate) {
m_master.resetOutputSampleRate(sampleRate);
m_auxA.resetOutputSampleRate(sampleRate);
m_auxB.resetOutputSampleRate(sampleRate);
}
2018-12-08 05:20:09 +00:00
} // namespace amuse