/* ==================================== JUCER_BINARY_RESOURCE ====================================

   This is an auto-generated file: Any edits you make may be overwritten!

*/

#include <cstring>

namespace scripts
{

//================== amp.lua ==================
static const unsigned char temp_binary_data_0[] =
"--- Stereo Amplifier in Lua.\n"
"--\n"
"-- The code contained implements a simple stereo amplifier plugin. It does not\n"
"-- try to smooth the volume parameter and could cause zipper noise.\n"
"--\n"
"-- @script      amp\n"
"-- @type        DSP\n"
"-- @license     GPL v3\n"
"-- @author      Michael Fisher\n"
"\n"
"local audio  = require ('el.audio')\n"
"\n"
"--- Gain parameters.\n"
"-- Used for fading between changes in volume\n"
"local gain1 = 1.0\n"
"local gain2 = 1.0\n"
"\n"
"--- Return a table of audio/midi inputs and outputs.\n"
"-- This plugin supports stereo in/out with no MIDI\n"
"local function amp_layout()\n"
"    return {\n"
"        audio   = { 2, 2 },\n"
"        midi    = { 0, 0 },\n"
"        control = {{\n"
"            {\n"
"                name        = \"Volume\",\n"
"                symbol      = \"volume\",\n"
"                label       = \"dB\",\n"
"                min         = -90.0,\n"
"                max         = 24.0,\n"
"                default     = 0.0\n"
"            }\n"
"        }}\n"
"    }\n"
"end\n"
"\n"
"--- Render audio and midi.\n"
"-- Use the provided audio and midi objects to process your plugin\n"
"-- @param a The source el.AudioBuffer\n"
"-- @param m The source el.MidiPipe\n"
"-- @param p Parameters\n"
"-- @param c Controls\n"
"-- @param t Time info\n"
"local function amp_process (a, m, p, c, t)\n"
"    gain2 = audio.togain (p [1])\n"
"    a:fade (gain1, gain2)\n"
"    gain1 = gain2\n"
"end\n"
"\n"
"return {\n"
"    type        = 'DSP',\n"
"    layout      = amp_layout,\n"
"    process     = amp_process\n"
"}\n"
"\n"
"-- SPDX-FileCopyrightText: Copyright (C) Kushview, LLC.\n"
"-- SPDX-License-Identifier: GPL-3.0-or-later\n";

const char* amp_lua = (const char*) temp_binary_data_0;

}

#include "luascripts.hpp"

namespace scripts
{

const char* getNamedResource (const char* resourceNameUTF8, int& numBytes);
const char* getNamedResource (const char* resourceNameUTF8, int& numBytes)
{
    unsigned int hash = 0;

    if (resourceNameUTF8 != nullptr)
        while (*resourceNameUTF8 != 0)
            hash = 31 * hash + (unsigned int) *resourceNameUTF8++;

    switch (hash)
    {
        case 0xcb93cafd:  numBytes = 1467; return amp_lua;
        case 0x5b238e91:  numBytes = 1690; return ampui_lua;
        case 0xf47b0c2a:  numBytes = 1861; return channelize_lua;
        case 0x75aa59c1:  numBytes = 1231; return commands_lua;
        case 0x8db33510:  numBytes = 881; return console_lua;
        case 0xe8d32332:  numBytes = 336; return content_lua;
        case 0xc25bb5ef:  numBytes = 5951; return spontonchordchooser_lua;
        case 0x474c335e:  numBytes = 672; return view_lua;
        default: break;
    }

    numBytes = 0;
    return nullptr;
}

const char* namedResourceList[] =
{
    "amp_lua",
    "ampui_lua",
    "channelize_lua",
    "commands_lua",
    "console_lua",
    "content_lua",
    "spontonchordchooser_lua",
    "view_lua"
};

const char* originalFilenames[] =
{
    "amp.lua",
    "ampui.lua",
    "channelize.lua",
    "commands.lua",
    "console.lua",
    "content.lua",
    "spontonchordchooser.lua",
    "view.lua"
};

const char* getNamedResourceOriginalFilename (const char* resourceNameUTF8);
const char* getNamedResourceOriginalFilename (const char* resourceNameUTF8)
{
    for (unsigned int i = 0; i < (sizeof (namedResourceList) / sizeof (namedResourceList[0])); ++i)
        if (strcmp (namedResourceList[i], resourceNameUTF8) == 0)
            return originalFilenames[i];

    return nullptr;
}

}
