コード例 #1
0
    float getParameterValue(const uint32_t index) const
    {
        DISTRHO_SAFE_ASSERT_RETURN(fPlugin != nullptr, 0.0f);
        DISTRHO_SAFE_ASSERT_RETURN(fData != nullptr && index < fData->parameterCount, 0.0f);

        return fPlugin->d_getParameterValue(index);
    }
コード例 #2
0
ファイル: Color.cpp プロジェクト: felipebetancur/zam-plugins
Color Color::fromHTML(const char* rgb, float alpha)
{
    Color fallback;
    DISTRHO_SAFE_ASSERT_RETURN(rgb != nullptr && rgb[0] != '\0', fallback);

    if (rgb[0] == '#') ++rgb;
    DISTRHO_SAFE_ASSERT_RETURN(rgb[0] != '\0', fallback);

    std::size_t rgblen(std::strlen(rgb));
    DISTRHO_SAFE_ASSERT_RETURN(rgblen == 3 || rgblen == 6, fallback);

    char rgbtmp[3] = { '\0', '\0', '\0' };
    int r, g, b;

    if (rgblen == 3)
    {
        rgbtmp[0] = rgb[0];
        r = static_cast<int>(std::strtol(rgbtmp, nullptr, 16));

        rgbtmp[0] = rgb[1];
        g = static_cast<int>(std::strtol(rgbtmp, nullptr, 16));

        rgbtmp[0] = rgb[2];
        b = static_cast<int>(std::strtol(rgbtmp, nullptr, 16));
    }
    else
    {
        rgbtmp[0] = rgb[0];
        rgbtmp[1] = rgb[1];
        r = static_cast<int>(std::strtol(rgbtmp, nullptr, 16));

        rgbtmp[0] = rgb[2];
        rgbtmp[1] = rgb[3];
        g = static_cast<int>(std::strtol(rgbtmp, nullptr, 16));

        rgbtmp[0] = rgb[4];
        rgbtmp[1] = rgb[5];
        b = static_cast<int>(std::strtol(rgbtmp, nullptr, 16));
    }

    return Color(r, g, b, static_cast<int>(getFixedRange(alpha)*255.0f));
}
コード例 #3
0
    /** Changes this ScopedPointer to point to a new object.

        Because a pointer can only belong to one ScopedPointer, this transfers
        the pointer from the other object to this one, and the other object is reset to
        be a null pointer.

        If this ScopedPointer already points to an object, that object
        will first be deleted.
    */
    ScopedPointer& operator=(ScopedPointer& objectToTransferFrom)
    {
        if (this != objectToTransferFrom.getAddress())
        {
            // Two ScopedPointers should never be able to refer to the same object - if
            // this happens, you must have done something dodgy!
            DISTRHO_SAFE_ASSERT_RETURN(object == nullptr || object != objectToTransferFrom.object, *this);

            ObjectType* const oldObject = object;
            object = objectToTransferFrom.object;
            objectToTransferFrom.object = nullptr;
            ContainerDeletePolicy<ObjectType>::destroy(oldObject);
        }

        return *this;
    }
コード例 #4
0
ファイル: NanoVG.cpp プロジェクト: ViktorNova/Carla
GLuint NanoImage::getTextureHandle() const
{
    DISTRHO_SAFE_ASSERT_RETURN(fHandle.context != nullptr && fHandle.imageId != 0, 0);

    return nvglImageHandle(fHandle.context, fHandle.imageId);
}
コード例 #5
0
    const ParameterRanges& getParameterRanges(const uint32_t index) const noexcept
    {
        DISTRHO_SAFE_ASSERT_RETURN(fData != nullptr && index < fData->parameterCount, sFallbackRanges);

        return fData->parameters[index].ranges;
    }
コード例 #6
0
    uint32_t getParameterHints(const uint32_t index) const noexcept
    {
        DISTRHO_SAFE_ASSERT_RETURN(fData != nullptr && index < fData->parameterCount, 0x0);

        return fData->parameters[index].hints;
    }
コード例 #7
0
    const d_string& getParameterUnit(const uint32_t index) const noexcept
    {
        DISTRHO_SAFE_ASSERT_RETURN(fData != nullptr && index < fData->parameterCount, sFallbackString);

        return fData->parameters[index].unit;
    }
コード例 #8
0
    uint32_t getParameterCount() const noexcept
    {
        DISTRHO_SAFE_ASSERT_RETURN(fData != nullptr, 0);

        return fData->parameterCount;
    }
コード例 #9
0
    uint32_t getLatency() const noexcept
    {
        DISTRHO_SAFE_ASSERT_RETURN(fData != nullptr, 0);

        return fData->latency;
    }
コード例 #10
0
    long getUniqueId() const noexcept
    {
        DISTRHO_SAFE_ASSERT_RETURN(fPlugin != nullptr, 0);

        return fPlugin->d_getUniqueId();
    }
コード例 #11
0
    uint32_t getVersion() const noexcept
    {
        DISTRHO_SAFE_ASSERT_RETURN(fPlugin != nullptr, 0);

        return fPlugin->d_getVersion();
    }
コード例 #12
0
    const char* getLicense() const noexcept
    {
        DISTRHO_SAFE_ASSERT_RETURN(fPlugin != nullptr, "");

        return fPlugin->d_getLicense();
    }