Exemplo n.º 1
0
void InstanceProcessor::loadPatch(std::string const& name, std::string const& path)
{
    suspendProcessing(true);
    if(isSuspended())
    {
        {
            releaseDsp();
            m_patch = pd::Patch(*this, name, path);
            pd::Patch patch(getPatch());
            if(patch.isValid())
            {
                m_patch_tie = pd::Tie(std::to_string(patch.getDollarZero()) + "-playhead");
            }
            else
            {
                m_patch_tie = pd::Tie();
                sendConsoleError("Camomile can't find the patch : " + name);
            }
        }
        parametersChanged();
        prepareDsp(getTotalNumInputChannels(), getTotalNumOutputChannels(),
                   AudioProcessor::getSampleRate(), getBlockSize());
        
        pd::PatchManager::notifyListeners();
    }
    
    suspendProcessing(false);
}
    void HandleEvent(ResetEvent ev)
    {
        if((FpAddress.board == ev.board && ev.cpu == 0) ||
           (FpAddress.board == ev.board && FpAddress.cpu == ev.cpu))
        {
            releaseDsp(FpAddress);

            if(ev.resetTransport)
                releaseTransport(TransportAddress);

            if(TempFpAddress.cpu != 0)
                releaseDsp(TempFpAddress);

            return;
        }
        if (TempFpAddress.cpu != 0 &&
            TempFpAddress.board == ev.board &&
            (ev.cpu == 0 || TempFpAddress.cpu == ev.cpu)
           )
            releaseDsp(TempFpAddress);
    };
Exemplo n.º 3
0
 Instance::~Instance() noexcept
 {
     if(m_ptr && m_count && --(*m_count) == 0)
     {
         Pd::lock();
         releaseDsp();
         delete m_count;
         pdinstance_free(reinterpret_cast<t_pdinstance *>(m_ptr));
         Pd::unlock();
         
         m_ptr   = nullptr;
         m_count =nullptr;
     }
 }
Exemplo n.º 4
0
void InstanceProcessor::closePatch()
{
    suspendProcessing(true);
    if(isSuspended())
    {
        {
            releaseDsp();
            m_patch = pd::Patch();
            m_patch_tie = pd::Tie();
        }
        
        parametersChanged();
        prepareDsp(getTotalNumInputChannels(), getTotalNumOutputChannels(),
                   AudioProcessor::getSampleRate(), getBlockSize());
        
        pd::PatchManager::notifyListeners();
    }
    suspendProcessing(false);
}
Exemplo n.º 5
0
 Instance& Instance::operator=(Instance const& other) noexcept
 {
     if(m_ptr && m_count && --(*m_count) == 0)
     {
         Pd::lock();
         releaseDsp();
         delete m_count;
         pdinstance_free(reinterpret_cast<t_pdinstance *>(m_ptr));
         Pd::unlock();
         
         m_ptr   = nullptr;
         m_count =nullptr;
     }
     if(other.m_ptr && other.m_count)
     {
         ++(*m_count);
         m_ptr   = other.m_ptr;
         m_count = other.m_count;
     }
     return *this;
 }
void releaseWholeDsp(Address address)
{
    address.task = 0;
    releaseDsp(address);
}
Exemplo n.º 7
0
void InstanceProcessor::releaseResources()
{
    releaseDsp();
}