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