/* * Carla Plugin Host * Copyright (C) 2011-2014 Filipe Coelho * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of * the License, or any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * For a full copy of the GNU General Public License see the doc/GPL.txt file. */ #include "CarlaEngineUtils.hpp" CARLA_BACKEND_START_NAMESPACE // ----------------------------------------------------------------------- // Carla Engine client (Abstract) CarlaEngineClient::CarlaEngineClient(const CarlaEngine& engine) noexcept : fEngine(engine), fActive(false), fLatency(0) { carla_debug("CarlaEngineClient::CarlaEngineClient()"); } CarlaEngineClient::~CarlaEngineClient() noexcept { CARLA_SAFE_ASSERT(! fActive); carla_debug("CarlaEngineClient::~CarlaEngineClient()"); } void CarlaEngineClient::activate() noexcept { CARLA_SAFE_ASSERT(! fActive); carla_debug("CarlaEngineClient::activate()"); fActive = true; } void CarlaEngineClient::deactivate() noexcept { CARLA_SAFE_ASSERT(fActive); carla_debug("CarlaEngineClient::deactivate()"); fActive = false; } bool CarlaEngineClient::isActive() const noexcept { return fActive; } bool CarlaEngineClient::isOk() const noexcept { return true; } uint32_t CarlaEngineClient::getLatency() const noexcept { return fLatency; } void CarlaEngineClient::setLatency(const uint32_t samples) noexcept { fLatency = samples; } CarlaEnginePort* CarlaEngineClient::addPort(const EnginePortType portType, const char* const name, const bool isInput) { CARLA_SAFE_ASSERT_RETURN(name != nullptr && name[0] != '\0', nullptr); carla_debug("CarlaEngineClient::addPort(%i:%s, \"%s\", %s)", portType, EnginePortType2Str(portType), name, bool2str(isInput)); switch (portType) { case kEnginePortTypeNull: break; case kEnginePortTypeAudio: return new CarlaEngineAudioPort(*this, isInput); case kEnginePortTypeCV: return new CarlaEngineCVPort(*this, isInput); case kEnginePortTypeEvent: return new CarlaEngineEventPort(*this, isInput); } carla_stderr("CarlaEngineClient::addPort(%i, \"%s\", %s) - invalid type", portType, name, bool2str(isInput)); return nullptr; } // ----------------------------------------------------------------------- CARLA_BACKEND_END_NAMESPACE