示例#1
0
 void DspNode::stop()
 {
     m_running = false;
     release();
     for(ulong i = 0; i < getNumberOfInputs(); i++)
     {
         m_inputs[i]->clear();
     }
     for(ulong i = 0; i < getNumberOfOutputs(); i++)
     {
         m_outputs[i]->clear();
     }
 }
示例#2
0
    void DspNode::start() throw(DspError&)
    {
        sDspChain chain = getChain();
        if(chain)
        {
            if(m_running)
            {
                stop();
            }

            m_samplerate = chain->getSampleRate();
            m_vectorsize = chain->getVectorSize();
            
            prepare();
            
            if(m_running)
            {
                for(ulong i = 0; i < getNumberOfInputs(); i++)
                {
                    try
                    {
                        m_inputs[i]->start(shared_from_this());
                    }
                    catch(DspError& e)
                    {
                        m_running = false;
                        throw e;
                    }
                    m_sample_ins[i] = m_inputs[i]->getVector();
                }
                for(ulong i = 0; i < getNumberOfOutputs(); i++)
                {
                    try
                    {
                        m_outputs[i]->start(shared_from_this());
                    }
                    catch(DspError& e)
                    {
                        m_running = false;
                        throw e;
                    }
                    
                    m_sample_outs[i] = m_outputs[i]->getVector();
                }
            }
        }
    }
示例#3
0
 DspNode::DspNode(sDspChain chain) noexcept :
 m_chain(chain),
 m_nins(0),
 m_sample_ins(nullptr),
 m_nouts(0),
 m_sample_outs(nullptr),
 m_samplerate(0),
 m_vectorsize(0),
 m_inplace(true),
 m_running(false)
 {
     for(ulong i = 0; i < getNumberOfInputs(); i++)
     {
         m_inputs.push_back(make_shared<DspInput>(i));
     }
     for(ulong i = 0; i < getNumberOfOutputs(); i++)
     {
         m_outputs.push_back(make_shared<DspOutput>(i));
     }
 }