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

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

*/

#include <cstring>

namespace scripts
{

//================== testtone.lua ==================
static const unsigned char temp_binary_data_10[] =
"--- Test Tone.\n"
"-- A simple sine wave generator, handy as a signal source for checking routing,\n"
"-- levels and metering. Frequency is in Hz and Level scales the output amplitude.\n"
"--\n"
"-- @script      testtone\n"
"-- @type        DSP\n"
"-- @license     GPL v3\n"
"-- @author      Michael Fisher\n"
"\n"
"-- Oscillator phase (radians) and current sample rate, kept across process blocks.\n"
"local phase = 0.0\n"
"local srate = 44100.0\n"
"\n"
"local function layout()\n"
"    return {\n"
"        audio   = { 0, 2 },\n"
"        midi    = { 0, 0 },\n"
"        control = {{\n"
"            {\n"
"                name    = \"Frequency\",\n"
"                symbol  = \"freq\",\n"
"                label   = \"Hz\",\n"
"                min     = 20.0,\n"
"                max     = 20000.0,\n"
"                default = 440.0\n"
"            },\n"
"            {\n"
"                name    = \"Level\",\n"
"                symbol  = \"level\",\n"
"                min     = 0.0,\n"
"                max     = 1.0,\n"
"                default = 0.5\n"
"            }\n"
"        }}\n"
"    }\n"
"end\n"
"\n"
"local function prepare (sampleRate, block)\n"
"    srate = sampleRate\n"
"    phase = 0.0\n"
"end\n"
"\n"
"local function process (a, m, p)\n"
"    local freq    = p[1]\n"
"    local level   = p[2]\n"
"    local nframes = a:length()\n"
"    local nchans  = a:channels()\n"
"    local inc     = (2.0 * math.pi * freq) / srate\n"
"\n"
"    for f = 1, nframes do\n"
"        local s = level * math.sin (phase)\n"
"\n"
"        for c = 1, nchans do\n"
"            a:set (c, f, s)\n"
"        end\n"
"\n"
"        phase = phase + inc\n"
"        if phase >= 2.0 * math.pi then\n"
"            phase = phase - 2.0 * math.pi\n"
"        end\n"
"    end\n"
"end\n"
"\n"
"return {\n"
"    type    = 'DSP',\n"
"    layout  = layout,\n"
"    prepare = prepare,\n"
"    process = process\n"
"}\n"
"\n"
"-- SPDX-FileCopyrightText: Copyright (C) Kushview, LLC.\n"
"-- SPDX-License-Identifier: GPL-3.0-or-later\n";

const char* testtone_lua = (const char*) temp_binary_data_10;
}
